fix: release CI #32
Workflow file for this run
This file contains hidden or 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: Draft Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| build-binaries: | |
| strategy: | |
| matrix: | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| # - x86_64-apple-darwin | |
| - aarch64-apple-darwin | |
| name: | |
| - commit-boost-cli | |
| - commit-boost-pbs | |
| - commit-boost-signer | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| # - target: x86_64-apple-darwin | |
| # os: macos-latest | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: "stable" | |
| fetch-depth: 0 | |
| - name: Log commit hash | |
| run: | | |
| echo "Releasing commit: $(git rev-parse HEAD)" | |
| - 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: Install protoc (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get install protobuf-compiler | |
| - name: Install protoc (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install protobuf | |
| - name: Set up Rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| override: true | |
| target: ${{ matrix.target }} | |
| - name: Build binary | |
| run: cargo build --release --target ${{ matrix.target }} --bin ${{ matrix.name }} | |
| env: | |
| CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: gcc | |
| - name: Package binary (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| tar -czvf ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz ${{ matrix.name }} | |
| mv ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz ../../../ | |
| - name: Package binary (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| 7z a ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.zip target\${{ matrix.target }}\release\${{ matrix.name }}.exe | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }} | |
| path: | | |
| ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.${{ runner.os == 'Windows' && 'zip' || 'tar.gz' }} | |
| build-and-push-pbs-docker: | |
| needs: [build-binaries] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: "stable" | |
| fetch-depth: 0 | |
| - 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 | |
| tags: | | |
| ghcr.io/commit-boost/pbs:${{ github.ref_name }} | |
| ${{ !contains(github.ref_name, 'rc') && 'ghcr.io/commit-boost/pbs:latest' || '' }} | |
| cache-from: type=registry,ref=ghcr.io/commit-boost/pbs:buildcache | |
| cache-to: type=registry,ref=ghcr.io/commit-boost/pbs:buildcache,mode=max | |
| file: provisioning/pbs.Dockerfile | |
| build-and-push-signer-docker: | |
| needs: [build-binaries] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: "stable" | |
| fetch-depth: 0 | |
| - 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 | |
| tags: | | |
| ghcr.io/commit-boost/signer:${{ github.ref_name }} | |
| ${{ !contains(github.ref_name, 'rc') && 'ghcr.io/commit-boost/signer:latest' || '' }} | |
| cache-from: type=registry,ref=ghcr.io/commit-boost/signer:buildcache | |
| cache-to: type=registry,ref=ghcr.io/commit-boost/signer:buildcache,mode=max | |
| file: provisioning/signer.Dockerfile | |
| finalize-release: | |
| needs: | |
| - build-binaries | |
| - 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 }} |