build and package release artifacts #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build release artifacts | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: The branch to build. | |
type: string | |
required: true | |
default: main | |
env: | |
JUST_BIN_URL: https://github.com/casey/just/releases/download/1.25.2/just-1.25.2-x86_64-unknown-linux-musl.tar.gz | |
jobs: | |
build: | |
name: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- os: ubuntu-latest | |
target: arm-unknown-linux-musleabi | |
- os: ubuntu-latest | |
target: armv7-unknown-linux-musleabihf | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branch }} | |
- uses: dtolnay/rust-toolchain@stable | |
# It's quite slow to install just by building it, but here we need a cross-platform solution. | |
- shell: bash | |
run: cargo install just | |
- shell: bash | |
run: just build-release-artifacts "${{ matrix.target }}" | |
- uses: actions/upload-artifact@main | |
with: | |
name: safe_network-${{ matrix.target }} | |
path: | | |
artifacts | |
!artifacts/.cargo-lock | |
# This job isn't necessary, but it's useful for debugging the packaging process for the real release | |
# workflow, just in case any issues are ever encountered there. | |
package: | |
name: publish and release | |
runs-on: ubuntu-latest | |
needs: [build] | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.S3_DEPLOY_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DEPLOY_AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: eu-west-2 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: "0" | |
token: ${{ secrets.VERSION_BUMP_COMMIT_PAT }} | |
- uses: actions/download-artifact@master | |
with: | |
name: safe_network-x86_64-pc-windows-msvc | |
path: artifacts/x86_64-pc-windows-msvc/release | |
- uses: actions/download-artifact@master | |
with: | |
name: safe_network-x86_64-unknown-linux-musl | |
path: artifacts/x86_64-unknown-linux-musl/release | |
- uses: actions/download-artifact@master | |
with: | |
name: safe_network-x86_64-apple-darwin | |
path: artifacts/x86_64-apple-darwin/release | |
- uses: actions/download-artifact@master | |
with: | |
name: safe_network-arm-unknown-linux-musleabi | |
path: artifacts/arm-unknown-linux-musleabi/release | |
- uses: actions/download-artifact@master | |
with: | |
name: safe_network-armv7-unknown-linux-musleabihf | |
path: artifacts/armv7-unknown-linux-musleabihf/release | |
- uses: actions/download-artifact@master | |
with: | |
name: safe_network-aarch64-unknown-linux-musl | |
path: artifacts/aarch64-unknown-linux-musl/release | |
# It's possible to `cargo install` just, but it's very slow to compile on GHA infra. | |
# Therefore we just pull the binary from the Github Release. | |
- name: install just | |
shell: bash | |
run: | | |
curl -L -O $JUST_BIN_URL | |
mkdir just | |
tar xvf just-1.25.2-x86_64-unknown-linux-musl.tar.gz -C just | |
rm just-1.25.2-x86_64-unknown-linux-musl.tar.gz | |
sudo mv just/just /usr/local/bin | |
rm -rf just | |
sudo apt-get install -y tree | |
- name: package artifacts | |
shell: bash | |
run: | | |
tree artifacts | |
just package-release-assets "safe" | |
just package-release-assets "safenode" | |
just package-release-assets "faucet" | |
just package-release-assets "safenode_rpc_client" | |
just package-release-assets "safenode-manager" | |
just package-release-assets "safenodemand" | |
just package-release-assets "node-launchpad" | |
- uses: actions/upload-artifact@main | |
with: | |
name: packaged_binaries | |
path: deploy |