Skip to content

Release v0.9.0 (#395) #45

Release v0.9.0 (#395)

Release v0.9.0 (#395) #45

Workflow file for this run

name: Draft Release
on:
push:
tags:
- "v*"
permissions:
contents: write
packages: write
jobs:
# Builds the x64 and arm64 binaries for Linux, for all 3 crates, via the Docker builder
build-binaries-linux:
strategy:
matrix:
target:
- amd64
- arm64
name:
- commit-boost-cli
- commit-boost-pbs
- commit-boost-signer
include:
- target: amd64
package-suffix: x86-64
- target: arm64
package-suffix: arm64
- name: commit-boost-cli
target-crate: cli
- name: commit-boost-pbs
target-crate: pbs
- name: commit-boost-signer
target-crate: signer
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: "stable"
fetch-depth: 0
submodules: true
- name: Log commit hash
run: |
echo "Releasing commit: $(git rev-parse HEAD)"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build binary (Linux)
uses: docker/build-push-action@v6
with:
context: .
push: false
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=ghcr.io/commit-boost/buildcache:${{ matrix.target-crate}}
cache-to: type=registry,ref=ghcr.io/commit-boost/buildcache:${{ matrix.target-crate }},mode=max
file: provisioning/build.Dockerfile
outputs: type=local,dest=build
build-args: |
TARGET_CRATE=${{ matrix.name }}
- name: Package binary (Linux)
run: |
cd build/linux_${{ matrix.target }}
tar -czvf ${{ matrix.name }}-${{ github.ref_name }}-linux_${{ matrix.package-suffix }}.tar.gz ${{ matrix.name }}
mv ${{ matrix.name }}-${{ github.ref_name }}-linux_${{ matrix.package-suffix }}.tar.gz ../../
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-${{ github.ref_name }}-linux_${{ matrix.package-suffix }}
path: |
${{ matrix.name }}-${{ github.ref_name }}-linux_${{ matrix.package-suffix }}.tar.gz
# Builds the arm64 binaries for Darwin, for all 3 crates, natively
build-binaries-darwin:
strategy:
matrix:
target:
# x64 requires macos-latest-large which is not available in the free tier
# - x86_64-apple-darwin
- aarch64-apple-darwin
name:
- commit-boost-cli
- commit-boost-pbs
- commit-boost-signer
include:
# - target: x86_64-apple-darwin
# os: macos-latest-large
# package-suffix: x86-64
- target: aarch64-apple-darwin
os: macos-latest
package-suffix: arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: "stable"
fetch-depth: 0
submodules: true
- name: Log commit hash
run: |
echo "Releasing commit: $(git rev-parse HEAD)"
- name: Install Protoc
run:
# Brew's version is much more up to date than the Linux ones, and installing the latest via script runs into curl issues so for now, brew's easier to use
# provisioning/protoc.sh
brew install protobuf
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache Cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
- name: Cache Cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ matrix.name }}-
${{ runner.os }}-cargo-build-${{ matrix.target }}-
${{ runner.os }}-cargo-build-
- name: Build binary (Darwin)
run: cargo build --release --target ${{ matrix.target }} --bin ${{ matrix.name }}
- name: Package binary (Darwin)
run: |
cd target/${{ matrix.target }}/release
tar -czvf ${{ matrix.name }}-${{ github.ref_name }}-darwin_${{ matrix.package-suffix }}.tar.gz ${{ matrix.name }}
mv ${{ matrix.name }}-${{ github.ref_name }}-darwin_${{ matrix.package-suffix }}.tar.gz ../../../
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-${{ github.ref_name }}-darwin_${{ matrix.package-suffix }}
path: |
${{ matrix.name }}-${{ github.ref_name }}-darwin_${{ matrix.package-suffix }}.tar.gz
# Builds the PBS Docker image
build-and-push-pbs-docker:
needs: [build-binaries-linux]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: "stable"
fetch-depth: 0
submodules: true
- name: Download binary archives
uses: actions/download-artifact@v4
with:
path: ./artifacts
pattern: "commit-boost-*"
- name: Extract binaries
run: |
mkdir -p ./artifacts/bin/linux_amd64
mkdir -p ./artifacts/bin/linux_arm64
tar -xzf ./artifacts/commit-boost-pbs-${{ github.ref_name }}-linux_x86-64/commit-boost-pbs-${{ github.ref_name }}-linux_x86-64.tar.gz -C ./artifacts/bin
mv ./artifacts/bin/commit-boost-pbs ./artifacts/bin/linux_amd64/commit-boost-pbs
tar -xzf ./artifacts/commit-boost-pbs-${{ github.ref_name }}-linux_arm64/commit-boost-pbs-${{ github.ref_name }}-linux_arm64.tar.gz -C ./artifacts/bin
mv ./artifacts/bin/commit-boost-pbs ./artifacts/bin/linux_arm64/commit-boost-pbs
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push PBS Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
build-args: |
BINARIES_PATH=./artifacts/bin
tags: |
ghcr.io/commit-boost/pbs:${{ github.ref_name }}
${{ !contains(github.ref_name, 'rc') && 'ghcr.io/commit-boost/pbs:latest' || '' }}
file: provisioning/pbs.Dockerfile
# Builds the Signer Docker image
build-and-push-signer-docker:
needs: [build-binaries-linux]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: "stable"
fetch-depth: 0
submodules: true
- name: Download binary archives
uses: actions/download-artifact@v4
with:
path: ./artifacts
pattern: "commit-boost-*"
- name: Extract binaries
run: |
mkdir -p ./artifacts/bin/linux_amd64
mkdir -p ./artifacts/bin/linux_arm64
tar -xzf ./artifacts/commit-boost-signer-${{ github.ref_name }}-linux_x86-64/commit-boost-signer-${{ github.ref_name }}-linux_x86-64.tar.gz -C ./artifacts/bin
mv ./artifacts/bin/commit-boost-signer ./artifacts/bin/linux_amd64/commit-boost-signer
tar -xzf ./artifacts/commit-boost-signer-${{ github.ref_name }}-linux_arm64/commit-boost-signer-${{ github.ref_name }}-linux_arm64.tar.gz -C ./artifacts/bin
mv ./artifacts/bin/commit-boost-signer ./artifacts/bin/linux_arm64/commit-boost-signer
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Signer Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
build-args: |
BINARIES_PATH=./artifacts/bin
tags: |
ghcr.io/commit-boost/signer:${{ github.ref_name }}
${{ !contains(github.ref_name, 'rc') && 'ghcr.io/commit-boost/signer:latest' || '' }}
file: provisioning/signer.Dockerfile
# Creates a draft release on GitHub with the binaries
finalize-release:
needs:
- build-binaries-linux
- build-binaries-darwin
- build-and-push-pbs-docker
- build-and-push-signer-docker
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
pattern: "commit-boost-*"
- name: Finalize Release
uses: softprops/action-gh-release@v2
with:
files: ./artifacts/**/*
draft: true
prerelease: false
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}