3ffee365e2
## Issue Addressed NA ## Proposed Changes Ensure the arm64 binary is build with the latest version of Rust.
273 lines
14 KiB
YAML
273 lines
14 KiB
YAML
name: Release Suite
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
|
|
env:
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
REPO_NAME: sigp/lighthouse
|
|
IMAGE_NAME: sigp/lighthouse
|
|
|
|
jobs:
|
|
extract-version:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Extract version
|
|
run: echo "::set-output name=VERSION::$(echo ${GITHUB_REF#refs/tags/})"
|
|
id: extract_version
|
|
outputs:
|
|
VERSION: ${{ steps.extract_version.outputs.VERSION }}
|
|
|
|
build-docker-arm64:
|
|
runs-on: ubuntu-18.04
|
|
needs: [extract-version]
|
|
# We need to enable experimental docker features in order to use `docker buildx`
|
|
env:
|
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
|
VERSION: ${{ needs.extract-version.outputs.VERSION }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Update Rust
|
|
run: rustup update stable
|
|
- name: Dockerhub login
|
|
run: |
|
|
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
|
- name: Cross build lighthouse binary
|
|
run: |
|
|
cargo install cross
|
|
make build-aarch64-portable
|
|
- name: Move cross-built ARM binary into Docker scope
|
|
run: |
|
|
mkdir ./bin;
|
|
mv ./target/aarch64-unknown-linux-gnu/release/lighthouse ./bin;
|
|
# Install dependencies for emulation. Have to create a new builder to pick up emulation support.
|
|
- name: Build ARM64 dockerfile (with push)
|
|
run: |
|
|
docker run --privileged --rm tonistiigi/binfmt --install arm64
|
|
docker buildx create --use --name cross-builder
|
|
docker buildx build \
|
|
--platform=linux/arm64 \
|
|
--file ./Dockerfile.cross . \
|
|
--tag ${IMAGE_NAME}:${{ env.VERSION }}-arm64 \
|
|
--push
|
|
build-docker-amd64:
|
|
runs-on: ubuntu-18.04
|
|
needs: [extract-version]
|
|
env:
|
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
|
VERSION: ${{ needs.extract-version.outputs.VERSION }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Dockerhub login
|
|
run: |
|
|
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
|
- name: Build AMD64 dockerfile (with push)
|
|
run: |
|
|
docker build \
|
|
--build-arg PORTABLE=true \
|
|
--tag ${IMAGE_NAME}:${{ env.VERSION }}-amd64 \
|
|
--file ./Dockerfile .
|
|
docker push ${IMAGE_NAME}:${{ env.VERSION }}-amd64
|
|
build-docker-multiarch:
|
|
runs-on: ubuntu-18.04
|
|
needs: [build-docker-arm64, build-docker-amd64, extract-version]
|
|
# We need to enable experimental docker features in order to use `docker manifest`
|
|
env:
|
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
|
VERSION: ${{ needs.extract-version.outputs.VERSION }}
|
|
steps:
|
|
- name: Dockerhub login
|
|
run: |
|
|
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
|
- name: Create and push multiarch manifest
|
|
run: |
|
|
docker manifest create ${IMAGE_NAME}:${{ env.VERSION }} \
|
|
--amend ${IMAGE_NAME}:${{ env.VERSION }}-arm64 \
|
|
--amend ${IMAGE_NAME}:${{ env.VERSION }}-amd64;
|
|
docker manifest push ${IMAGE_NAME}:${{ env.VERSION }}
|
|
build:
|
|
name: Build Release
|
|
strategy:
|
|
matrix:
|
|
arch: [aarch64-unknown-linux-gnu,
|
|
aarch64-unknown-linux-gnu-portable,
|
|
x86_64-unknown-linux-gnu,
|
|
x86_64-unknown-linux-gnu-portable,
|
|
x86_64-apple-darwin,
|
|
x86_64-apple-darwin-portable]
|
|
include:
|
|
- arch: aarch64-unknown-linux-gnu
|
|
platform: ubuntu-latest
|
|
- arch: aarch64-unknown-linux-gnu-portable
|
|
platform: ubuntu-latest
|
|
- arch: x86_64-unknown-linux-gnu
|
|
platform: ubuntu-latest
|
|
- arch: x86_64-unknown-linux-gnu-portable
|
|
platform: ubuntu-latest
|
|
- arch: x86_64-apple-darwin
|
|
platform: macos-latest
|
|
- arch: x86_64-apple-darwin-portable
|
|
platform: macos-latest
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
needs: extract-version
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v2
|
|
- name: Build toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
profile: minimal
|
|
override: true
|
|
|
|
# ==============================
|
|
# Builds
|
|
# ==============================
|
|
|
|
- name: Build Lighthouse for aarch64-unknown-linux-gnu-portable
|
|
if: matrix.arch == 'aarch64-unknown-linux-gnu-portable'
|
|
run: |
|
|
cargo install cross
|
|
make build-aarch64-portable
|
|
|
|
- name: Build Lighthouse for aarch64-unknown-linux-gnu
|
|
if: matrix.arch == 'aarch64-unknown-linux-gnu'
|
|
run: |
|
|
cargo install cross
|
|
make build-aarch64
|
|
|
|
- name: Build Lighthouse for x86_64-unknown-linux-gnu-portable
|
|
if: matrix.arch == 'x86_64-unknown-linux-gnu-portable'
|
|
run: |
|
|
cargo install cross
|
|
make build-x86_64-portable
|
|
|
|
- name: Build Lighthouse for x86_64-unknown-linux-gnu
|
|
if: matrix.arch == 'x86_64-unknown-linux-gnu'
|
|
run: |
|
|
cargo install cross
|
|
make build-x86_64
|
|
|
|
- name: Move cross-compiled binary
|
|
if: startsWith(matrix.arch, 'aarch64')
|
|
run: mv target/aarch64-unknown-linux-gnu/release/lighthouse ~/.cargo/bin/lighthouse
|
|
|
|
- name: Move cross-compiled binary
|
|
if: startsWith(matrix.arch, 'x86_64-unknown-linux-gnu')
|
|
run: mv target/x86_64-unknown-linux-gnu/release/lighthouse ~/.cargo/bin/lighthouse
|
|
|
|
- name: Build Lighthouse for x86_64-apple-darwin portable
|
|
if: matrix.arch == 'x86_64-apple-darwin-portable'
|
|
run: cargo install --path lighthouse --force --locked --features portable
|
|
|
|
- name: Build Lighthouse for x86_64-apple-darwin modern
|
|
if: matrix.arch == 'x86_64-apple-darwin'
|
|
run: cargo install --path lighthouse --force --locked --features modern
|
|
|
|
- name: Configure GPG and create artifacts
|
|
env:
|
|
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
|
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
|
run: |
|
|
export GPG_TTY=$(tty)
|
|
echo "$GPG_SIGNING_KEY" | gpg --batch --import
|
|
mkdir artifacts
|
|
mv ~/.cargo/bin/lighthouse ./artifacts
|
|
cd artifacts
|
|
tar -czf lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz lighthouse
|
|
echo "$GPG_PASSPHRASE" | gpg --passphrase-fd 0 --pinentry-mode loopback --batch -ab lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz
|
|
mv *tar.gz* ..
|
|
|
|
# =======================================================================
|
|
# Upload artifacts
|
|
# This is required to share artifacts between different jobs
|
|
# =======================================================================
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz
|
|
path: lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz
|
|
|
|
- name: Upload signature
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz.asc
|
|
path: lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz.asc
|
|
|
|
draft-release:
|
|
name: Draft Release
|
|
needs: [build, extract-version]
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
VERSION: ${{ needs.extract-version.outputs.VERSION }}
|
|
steps:
|
|
# This is necessary for generating the changelog. It has to come before "Download Artifacts" or else it deletes the artifacts.
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# ==============================
|
|
# Download artifacts
|
|
# ==============================
|
|
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v2
|
|
|
|
# ==============================
|
|
# Create release draft
|
|
# ==============================
|
|
|
|
- name: Generate Full Changelog
|
|
id: changelog
|
|
run: echo "::set-output name=CHANGELOG::$(git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 ${{ env.VERSION }}^)..${{ env.VERSION }})"
|
|
|
|
- name: Create Release Draft
|
|
env:
|
|
GITHUB_USER: sigp
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# The formatting here is borrowed from OpenEthereum: https://github.com/openethereum/openethereum/blob/main/.github/workflows/build.yml
|
|
run: |
|
|
body=$(cat <<- "ENDBODY"
|
|
<Rick and Morty character>
|
|
|
|
## Summary
|
|
|
|
Add a summary.
|
|
|
|
## All Changes
|
|
|
|
${{ steps.changelog.outputs.CHANGELOG }}
|
|
|
|
## Binaries
|
|
|
|
[See pre-built binaries documentation.](https://lighthouse-book.sigmaprime.io/installation-binaries.html)
|
|
|
|
The binaries are signed with Sigma Prime's PGP key: `15E66D941F697E28F49381F426416DC3F30674B0`
|
|
|
|
| System | Architecture | Binary | PGP Signature |
|
|
|:---:|:---:|:---:|:---|
|
|
| <img src="https://simpleicons.org/icons/apple.svg" style="width: 32px;"/> | x86_64 | [lighthouse-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz) | [PGP Signature](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz.asc) |
|
|
| <img src="https://simpleicons.org/icons/apple.svg" style="width: 32px;"/> | x86_64 | [lighthouse-${{ env.VERSION }}-x86_64-apple-darwin-portable.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-apple-darwin-portable.tar.gz) | [PGP Signature](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-apple-darwin-portable.tar.gz.asc) |
|
|
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | x86_64 | [lighthouse-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz) | [PGP Signature](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz.asc) |
|
|
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | x86_64 | [lighthouse-${{ env.VERSION }}-x86_64-unknown-linux-gnu-portable.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-unknown-linux-gnu-portable.tar.gz) | [PGP Signature](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-x86_64-unknown-linux-gnu-portable.tar.gz.asc) |
|
|
| <img src="https://simpleicons.org/icons/raspberrypi.svg" style="width: 32px;"/> | aarch64 | [lighthouse-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz) | [PGP Signature](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz.asc) |
|
|
| <img src="https://simpleicons.org/icons/raspberrypi.svg" style="width: 32px;"/> | aarch64 | [lighthouse-${{ env.VERSION }}-aarch64-unknown-linux-gnu-portable.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-aarch64-unknown-linux-gnu-portable.tar.gz) | [PGP Signature](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/lighthouse-${{ env.VERSION }}-aarch64-unknown-linux-gnu-portable.tar.gz.asc) |
|
|
| | | | |
|
|
| **System** | **Option** | - | **Resource** |
|
|
| <img src="https://simpleicons.org/icons/docker.svg" style="width: 32px;"/> | Docker | [${{ env.VERSION }}](https://hub.docker.com/r/${{ env.IMAGE_NAME }}/tags?page=1&ordering=last_updated&name=${{ env.VERSION }}) | [${{ env.IMAGE_NAME }}](https://hub.docker.com/r/${{ env.IMAGE_NAME }}) |
|
|
ENDBODY
|
|
)
|
|
assets=()
|
|
for asset in ./lighthouse-*.tar.gz*; do
|
|
assets+=("-a" "$asset/$asset")
|
|
done
|
|
tag_name="${{ env.VERSION }}"
|
|
echo "$body" | hub release create --draft "${assets[@]}" -F "-" "$tag_name"
|