release #10
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
| # This workflow is modified from Reth: | |
| # https://github.com/paradigmxyz/reth/blob/main/.github/workflows/release.yml | |
| name: release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - v* | |
| env: | |
| REPO_NAME: ${{ github.event.repository.name }} | |
| IMAGE_NAME: ${{ github.repository }} | |
| CARGO_TERM_COLOR: always | |
| REGISTRY: ghcr.io | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| extract-version: | |
| name: extract version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Extract version | |
| run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT | |
| id: extract_version | |
| outputs: | |
| VERSION: ${{ steps.extract_version.outputs.VERSION }} | |
| build-and-push: | |
| name: build and push docker | |
| runs-on: ubuntu-latest | |
| needs: extract-version | |
| steps: | |
| - name: Check Out Repo | |
| uses: actions/checkout@v4 | |
| - name: Log in to Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| push: true | |
| tags: | | |
| ${{ env.IMAGE_NAME }}:${{ needs.extract-version.outputs.VERSION }} | |
| ${{ env.IMAGE_NAME }}:latest | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-binaries: | |
| name: build binaries | |
| needs: [build-and-push, extract-version] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| os: linux | |
| arch: x86_64 | |
| binary: world-chain-builder | |
| - runner: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-gnu | |
| os: linux | |
| arch: arm64 | |
| binary: world-chain-builder | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Cargo Build Release | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Move binary | |
| run: | | |
| mkdir artifacts | |
| mv "target/${{ matrix.target }}/release/${{ matrix.binary }}" ./artifacts | |
| - 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 -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --batch --import | |
| cd artifacts | |
| tar -czf ${{ env.REPO_NAME }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}.tar.gz ${{ matrix.binary }}* | |
| echo "$GPG_PASSPHRASE" | gpg --passphrase-fd 0 --pinentry-mode loopback --batch -ab ${{ env.REPO_NAME }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}.tar.gz | |
| mv *tar.gz* .. | |
| shell: bash | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.REPO_NAME }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}.tar.gz | |
| path: ${{ matrix.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}.tar.gz | |
| - name: Upload signature | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.REPO_NAME }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}.tar.gz.asc | |
| path: ${{ env.REPO_NAME }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}.tar.gz.asc | |
| draft-release: | |
| name: draft release | |
| needs: [build-and-push, extract-version, build-binaries] | |
| runs-on: ubuntu-latest | |
| env: | |
| VERSION: ${{ needs.extract-version.outputs.VERSION }} | |
| REPO_NAME: ${{ github.event.repository.name }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Generate full changelog | |
| id: changelog | |
| run: | | |
| echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT | |
| echo "$(git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 ${{ env.VERSION }}^)..${{ env.VERSION }})" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create release draft | |
| env: | |
| GITHUB_USER: ${{ github.repository_owner }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| body=$(cat <<- "ENDBODY" | |
| ## All Changes | |
| ${{ steps.changelog.outputs.CHANGELOG }} | |
| ## Binaries | |
| | System | Architecture | Binary | PGP Signature | | |
| |:---:|:---:|:---:|:---| | |
| | <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | x86_64 | [${{ env.REPO_NAME }}-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/${{ env.REPO_NAME }}-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz) | [PGP Signature](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/${{ env.REPO_NAME }}-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz.asc) | | |
| | <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | aarch64 | [${{ env.REPO_NAME }}-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/${{ env.REPO_NAME }}-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz) | [PGP Signature](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/${{ env.REPO_NAME }}-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz.asc) | | |
| | | | | | | |
| | **System** | **Option** | - | **Resource** | | |
| | <img src="https://simpleicons.org/icons/docker.svg" style="width: 32px;"/> | Docker | | [${{ env.IMAGE_NAME }}](https://github.com/worldcoin/world-chain/pkgs/container/world-chain) | | |
| ENDBODY | |
| ) | |
| assets=() | |
| for asset in ./*world-chain-*.tar.gz*; do | |
| assets+=("$asset/$asset") | |
| done | |
| tag_name="${{ env.VERSION }}" | |
| echo "$body" | gh release create --draft -t "$tag_name" -F "-" "$tag_name" "${assets[@]}" |