Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Build Docusaurus
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0

Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/release-gate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release Gate
on:
pull_request:
types: [closed]
branches: [main]
paths: ['.releases/**']

jobs:
create-release-tag:
name: Create tag from release request
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.event.pull_request.merged == true
permissions:
contents: write
steps:
- name: Fail if App credentials are not configured
run: |
if [ -z "${{ secrets.APP_ID }}" ] || [ -z "${{ secrets.APP_PRIVATE_KEY }}" ]; then
echo "❌ APP_ID and APP_PRIVATE_KEY must be configured."
echo "For fork testing, install a personal GitHub App on the fork,"
echo "create a private key, and add both as repository secrets."
exit 1
fi

- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: actions/create-github-app-token@v3
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- uses: actions/setup-python@v6
with:
python-version: '3.x'

- name: Install Python deps
run: pip install pyyaml

- name: Create tag from release request
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
REPO: ${{ github.repository }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
run: python .github/workflows/release/release.py gate
154 changes: 92 additions & 62 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,53 @@ on:
permissions:
contents: write
packages: write
id-token: write

jobs:
check-ci-status:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: actions/setup-python@v6
with:
python-version: '3.x'

- name: Install Python deps
run: pip install pyyaml

- name: Verify CI passed for this commit
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
run: python .github/workflows/release/release.py check-ci "${{ github.sha }}"

# Determines whether this tag should update :latest on GHCR.
# Runs once; the Docker job consumes its output via matrix.
determine-latest:
needs: [check-ci-status]
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
value: ${{ steps.is_latest.outputs.value }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Check is-latest
id: is_latest
run: |
VALUE=$(python .github/workflows/release/release.py is-latest "${{ github.ref_name }}")
echo "value=$VALUE" >> $GITHUB_OUTPUT

# Builds the x64 and arm64 binaries for Linux, for all 3 crates, via the Docker builder
build-binaries-linux:
needs: [check-ci-status]
timeout-minutes: 60
strategy:
matrix:
target:
Expand All @@ -35,7 +78,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: true
Expand All @@ -44,6 +87,9 @@ jobs:
run: |
echo "Releasing commit: $(git rev-parse HEAD)"

- name: Set lowercase owner
run: echo "OWNER=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

Expand All @@ -63,8 +109,8 @@ jobs:
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
cache-from: type=registry,ref=ghcr.io/${{ env.OWNER }}/buildcache:${{ matrix.target-crate}}
cache-to: type=registry,ref=ghcr.io/${{ env.OWNER }}/buildcache:${{ matrix.target-crate }},mode=max
file: provisioning/build.Dockerfile
outputs: type=local,dest=build
build-args: |
Expand All @@ -85,6 +131,8 @@ jobs:

# Builds the arm64 binaries for Darwin, for all 3 crates, natively
build-binaries-darwin:
needs: [check-ci-status]
timeout-minutes: 60
strategy:
matrix:
target:
Expand All @@ -105,7 +153,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: true
Expand Down Expand Up @@ -158,13 +206,17 @@ jobs:
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]
# Builds and pushes Docker images for both PBS and Signer
build-and-push-docker:
needs: [check-ci-status, build-binaries-linux, determine-latest]
strategy:
matrix:
crate: [pbs, signer]
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: true
Expand All @@ -179,10 +231,13 @@ jobs:
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
tar -xzf ./artifacts/commit-boost-${{ matrix.crate }}-${{ github.ref_name }}-linux_x86-64/commit-boost-${{ matrix.crate }}-${{ github.ref_name }}-linux_x86-64.tar.gz -C ./artifacts/bin
mv ./artifacts/bin/commit-boost-${{ matrix.crate }} ./artifacts/bin/linux_amd64/commit-boost-${{ matrix.crate }}
tar -xzf ./artifacts/commit-boost-${{ matrix.crate }}-${{ github.ref_name }}-linux_arm64/commit-boost-${{ matrix.crate }}-${{ github.ref_name }}-linux_arm64.tar.gz -C ./artifacts/bin
mv ./artifacts/bin/commit-boost-${{ matrix.crate }} ./artifacts/bin/linux_arm64/commit-boost-${{ matrix.crate }}

- name: Set lowercase owner
run: echo "OWNER=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -197,7 +252,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push PBS Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
Expand All @@ -206,76 +261,51 @@ jobs:
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
ghcr.io/${{ env.OWNER }}/${{ matrix.crate }}:${{ github.ref_name }}
${{ needs.determine-latest.outputs.value == 'true' && format('ghcr.io/{0}/{1}:latest', env.OWNER, matrix.crate) || '' }}
file: provisioning/${{ matrix.crate }}.Dockerfile

# Builds the Signer Docker image
build-and-push-signer-docker:
needs: [build-binaries-linux]
# Signs all Linux binaries with Sigstore for provenance
sign-binaries:
needs: [check-ci-status, build-binaries-linux]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Download binary archives
- name: Download binary artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
pattern: "commit-boost-*"
pattern: "commit-boost-*linux*"

- 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
- name: Sign all binaries with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
inputs: ./artifacts/**/*.tar.gz

- name: Build and push Signer Docker image
uses: docker/build-push-action@v6
- name: Upload signed artifacts
uses: actions/upload-artifact@v4
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
name: signed-${{ github.ref_name }}
path: ./artifacts/**/*

# Creates a draft release on GitHub with the binaries
finalize-release:
needs:
- check-ci-status
- build-binaries-linux
- build-binaries-darwin
- build-and-push-pbs-docker
- build-and-push-signer-docker
- build-and-push-docker
- sign-binaries
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Download artifacts
- name: Download artifacts (binaries + signed bundles)
uses: actions/download-artifact@v4
with:
path: ./artifacts
pattern: "commit-boost-*"
pattern: |
commit-boost-*
signed-*

- name: Finalize Release
uses: softprops/action-gh-release@v2
Expand Down
Loading
Loading