mac on release action #138
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: Release | ||
|
Check failure on line 1 in .github/workflows/release.yaml
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" | ||
| workflow_dispatch: | ||
| inputs: | ||
| draft-release: | ||
| default: false | ||
| description: "Draft Release" | ||
| required: false | ||
| type: boolean | ||
| build-docker: | ||
| default: false | ||
| description: "Build Docker" | ||
| required: false | ||
| type: boolean | ||
| build-binary: | ||
| default: true | ||
| description: "Build Binary" | ||
| required: false | ||
| type: boolean | ||
| platform: | ||
| default: 'linux' | ||
| description: "Target Platform" | ||
| options: | ||
| - 'linux' | ||
| - 'mac-m1' | ||
| required: false | ||
| type: choice | ||
| features: | ||
| default: '' | ||
| description: "Binary Compilation Features" | ||
| options: | ||
| - '' | ||
| - 'redact-sensitive' | ||
| required: false | ||
| type: choice | ||
| jobs: | ||
| extract-version: | ||
| name: Extract version | ||
| runs-on: warp-ubuntu-2404-x64-2x | ||
| outputs: | ||
| VERSION: ${{ steps.extract_version.outputs.VERSION }} | ||
| steps: | ||
| - name: Extract version | ||
| id: extract_version | ||
| run: | | ||
| if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then | ||
| VERSION="${GITHUB_REF#refs/tags/}" | ||
| else | ||
| VERSION="$(echo ${GITHUB_SHA} | cut -c1-7)" | ||
| fi | ||
| echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | ||
| echo "${VERSION}" | ||
| echo "### Version: \`${VERSION}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "| | |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| ------------------- | ---------------------- |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| \`GITHUB_REF_TYPE\` | \`${GITHUB_REF_TYPE}\` |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| \`GITHUB_REF_NAME\` | \`${GITHUB_REF_NAME}\` |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| \`GITHUB_REF\` | \`${GITHUB_REF}\` |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| \`GITHUB_SHA\` | \`${GITHUB_SHA}\` |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| \`VERSION\` | \`${VERSION}\` |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| \`PLATFORM\` | \`${{ github.event.inputs.platform || 'linux (default)' }}\` |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| \`FEATURES\` | \`${{ github.event.inputs.features || 'none' }}\` |" >> $GITHUB_STEP_SUMMARY | ||
| build-binary: | ||
| name: Build binary (${{ matrix.target }}) | ||
| needs: extract-version | ||
| # Run if: (build-binary enabled OR tag push) AND (platform matches) | ||
| # - Tag pushes: only build Linux | ||
| # - Manual dispatch: build selected platform (defaults to Linux) | ||
| if: | | ||
| (github.event.inputs.build-binary == 'true' || github.event_name == 'push') && | ||
| ( | ||
| (github.event_name == 'push' && matrix.platform == 'linux') || | ||
| (github.event_name == 'workflow_dispatch' && (github.event.inputs.platform == matrix.platform || (github.event.inputs.platform == '' && matrix.platform == 'linux'))) | ||
| ) | ||
| runs-on: ${{ matrix.runner }} | ||
| permissions: | ||
| contents: write | ||
| packages: write | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - target: x86_64-unknown-linux-gnu | ||
| runner: warp-ubuntu-latest-x64-32x | ||
| profile: reproducible | ||
| platform: linux | ||
| - target: aarch64-apple-darwin | ||
| runner: warp-macos-14-arm64-6x | ||
| profile: release | ||
| platform: mac-m1 | ||
| features: | ||
| - ${{ github.event.inputs.features || '' }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Install rust | ||
| run: | | ||
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
| - name: Build reproducible binary with Docker | ||
| run: | | ||
| RUST_TOOLCHAIN=$(rustc --version | cut -d' ' -f2) | ||
| docker build \ | ||
| --build-arg "RUST_TOOLCHAIN=${RUST_TOOLCHAIN}" \ | ||
| --build-arg "FEATURES=${{ matrix.features }}" \ | ||
| --build-arg "VERSION=${{ needs.extract-version.outputs.VERSION }}" \ | ||
| -f docker/Dockerfile.reproducible -t rbuilder:release \ | ||
| --output type=local,dest=./target . | ||
| - name: Upload rbuilder artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: rbuilder-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}${{ matrix.features && '-' }}${{ matrix.features }} | ||
| path: target/${{ matrix.profile }}/rbuilder | ||
| - name: Upload rbuilder-operator artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: rbuilder-operator-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}${{ matrix.features && '-' }}${{ matrix.features }} | ||
| path: target/${{ matrix.profile }}/rbuilder-operator | ||
| - name: Upload tbv-bidding-service artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: tbv-bidding-service-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}${{ matrix.features && '-' }}${{ matrix.features }} | ||
| path: target/${{ matrix.profile }}/tbv-bidding-service | ||
| - name: Upload reth-rbuilder artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: reth-rbuilder-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}${{ matrix.features && '-' }}${{ matrix.features }} | ||
| path: target/${{ matrix.profile }}/reth-rbuilder | ||
| - name: Upload bid-scraper artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: bid-scraper-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}${{ matrix.features && '-' }}${{ matrix.features }} | ||
| path: target/${{ matrix.profile }}/bid-scraper | ||
| - name: Upload rbuilder-rebalancer artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: rbuilder-rebalancer-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}${{ matrix.features && '-' }}${{ matrix.features }} | ||
| path: target/${{ matrix.profile }}/rbuilder-rebalancer | ||
| - name: Upload *.deb packages | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: deb-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}${{ matrix.features && '-' }}${{ matrix.features }} | ||
| path: target/debian/*.deb | ||
| draft-release: | ||
| name: Draft release | ||
| if: ${{ github.event.inputs.draft-release == 'true' || github.event_name == 'push'}} # when manually triggered or version tagged | ||
| needs: [extract-version, build-binary] | ||
| runs-on: warp-ubuntu-2404-x64-16x | ||
| env: | ||
| VERSION: ${{ needs.extract-version.outputs.VERSION }} | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Download artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| merge-multiple: true | ||
| path: artifacts | ||
| - name: Record artifacts checksums | ||
| working-directory: artifacts | ||
| run: | | ||
| find ./ || true | ||
| for file in *; do sha256sum "$file" >> sha256sums.txt; done; | ||
| cat sha256sums.txt | ||
| - name: Create release draft | ||
| uses: softprops/action-gh-release@v2.0.5 | ||
| id: create-release-draft | ||
| with: | ||
| draft: true | ||
| files: artifacts/* | ||
| generate_release_notes: true | ||
| name: ${{ env.VERSION }} | ||
| tag_name: ${{ env.VERSION }} | ||
| - name: Write Github Step Summary | ||
| run: | | ||
| echo "---" | ||
| echo "### Release Draft: ${{ env.VERSION }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "${{ steps.create-release-draft.outputs.url }}" >> $GITHUB_STEP_SUMMARY | ||
| build-docker: | ||
| if: ${{ github.event.inputs.build-docker == 'true' }} | ||
| name: Build and publish Docker image | ||
| needs: extract-version | ||
| runs-on: warp-ubuntu-2404-x64-16x | ||
| env: | ||
| VERSION: ${{ needs.extract-version.outputs.VERSION }} | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: checkout sources | ||
| uses: actions/checkout@v4 | ||
| - name: docker qemu | ||
| uses: docker/setup-qemu-action@v3 | ||
| - name: docker buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: docker metadata | ||
| uses: docker/metadata-action@v5 | ||
| id: meta | ||
| with: | ||
| images: ghcr.io/${{ github.repository }} | ||
| labels: org.opencontainers.image.source=${{ github.repositoryUrl }} | ||
| tags: | | ||
| type=sha | ||
| type=semver,pattern={{version}},value=${{ env.VERSION }} | ||
| type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }} | ||
| type=semver,pattern={{major}},value=${{ env.VERSION }} | ||
| # Push latest tag for full version only, not for prerelease versions (i.e. not for v1.2.3-rc1) | ||
| type=raw,value=latest,enable=${{ !contains(env.VERSION, '-') }} | ||
| - name: docker login | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: docker build and push | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| file: docker/Dockerfile.rbuilder | ||
| context: . | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| platforms: linux/amd64 | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||