Release #246
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 | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| deployments: write | |
| packages: write | |
| contents: write | |
| env: | |
| PACKAGE_DIR: pkg | |
| PACKAGE_RETENTION: 7 | |
| PUB_DIR: pub | |
| SCRIPTS_PATH: ${{ github.workspace }}/scripts/build | |
| jobs: | |
| build: | |
| name: Build Nethermind packages | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| package-prefix: ${{ steps.version.outputs.package-prefix }} | |
| prerelease: ${{ steps.version.outputs.prerelease }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v5 | |
| - name: Detect version | |
| id: version | |
| working-directory: src/Nethermind | |
| run: | | |
| sudo apt-get update && sudo apt-get install xmlstarlet -y --no-install-recommends | |
| version_prefix=$(xmlstarlet sel -t -v "//Project/PropertyGroup/VersionPrefix" Directory.Build.props) | |
| version_suffix=$(xmlstarlet sel -t -v "//Project/PropertyGroup/VersionSuffix" Directory.Build.props 2>/dev/null || echo "") | |
| version=$([[ -n "$version_suffix" ]] && echo "$version_prefix-$version_suffix" || echo "$version_prefix") | |
| package_prefix=nethermind-$version-${GITHUB_SHA:0:8} | |
| echo "Detected version $version" | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| echo "prerelease=$([[ -n "$version_suffix" ]] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT | |
| echo "package-prefix=$package_prefix" >> $GITHUB_OUTPUT | |
| echo "PACKAGE_PREFIX=$package_prefix" >> $GITHUB_ENV | |
| - name: Build Nethermind.Runner | |
| id: build | |
| run: | | |
| mkdir $GITHUB_WORKSPACE/$PUB_DIR | |
| docker build . -t nethermind-build -f $SCRIPTS_PATH/Dockerfile \ | |
| --build-arg COMMIT_HASH=$GITHUB_SHA \ | |
| --build-arg SOURCE_DATE_EPOCH=$(git log -1 --format=%ct) | |
| docker run --rm --mount type=bind,source=$GITHUB_WORKSPACE/$PUB_DIR,target=/output nethermind-build | |
| - name: Archive packages | |
| run: $SCRIPTS_PATH/archive.sh | |
| - name: Upload Nethermind Linux arm64 package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGE_PREFIX }}-linux-arm64-package | |
| path: ${{ github.workspace }}/${{ env.PACKAGE_DIR }}/*linux-arm64* | |
| retention-days: ${{ env.PACKAGE_RETENTION }} | |
| - name: Upload Nethermind Linux x64 package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGE_PREFIX }}-linux-x64-package | |
| path: ${{ github.workspace }}/${{ env.PACKAGE_DIR }}/*linux-x64* | |
| retention-days: ${{ env.PACKAGE_RETENTION }} | |
| - name: Upload Nethermind macOS arm64 package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGE_PREFIX }}-macos-arm64-package | |
| path: ${{ github.workspace }}/${{ env.PACKAGE_DIR }}/*macos-arm64* | |
| retention-days: ${{ env.PACKAGE_RETENTION }} | |
| - name: Upload Nethermind macOS x64 package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGE_PREFIX }}-macos-x64-package | |
| path: ${{ github.workspace }}/${{ env.PACKAGE_DIR }}/*macos-x64* | |
| retention-days: ${{ env.PACKAGE_RETENTION }} | |
| - name: Upload Nethermind Windows x64 package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGE_PREFIX }}-windows-x64-package | |
| path: ${{ github.workspace }}/${{ env.PACKAGE_DIR }}/*windows-x64* | |
| retention-days: ${{ env.PACKAGE_RETENTION }} | |
| - name: Upload Nethermind reference assemblies | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGE_PREFIX }}-ref-assemblies-package | |
| path: ${{ github.workspace }}/${{ env.PACKAGE_DIR }}/*ref-assemblies* | |
| retention-days: ${{ env.PACKAGE_RETENTION }} | |
| approval: | |
| name: Approve | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: | |
| name: Releases | |
| url: https://github.com/NethermindEth/nethermind/releases/tag/${{ needs.build.outputs.version }} | |
| steps: | |
| - name: Wait for approval | |
| run: echo "Waiting for approval..." | |
| publish-github: | |
| name: Publish to GitHub | |
| runs-on: ubuntu-latest | |
| needs: [approval, build] | |
| steps: | |
| - name: Check out Nethermind repository | |
| uses: actions/checkout@v5 | |
| - name: Authenticate App | |
| id: gh-app | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ vars.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ${{ github.workspace }}/${{ env.PACKAGE_DIR }} | |
| - name: Publish | |
| env: | |
| GIT_TAG: ${{ needs.build.outputs.version }} | |
| GITHUB_TOKEN: ${{ steps.gh-app.outputs.token }} | |
| PACKAGE_PREFIX: ${{ needs.build.outputs.package-prefix }} | |
| PRERELEASE: ${{ needs.build.outputs.prerelease }} | |
| run: | | |
| cp $GITHUB_WORKSPACE/$PACKAGE_DIR/**/*.zip $GITHUB_WORKSPACE/$PACKAGE_DIR | |
| rm -rf $GITHUB_WORKSPACE/$PACKAGE_DIR/*/ | |
| $SCRIPTS_PATH/publish-github.sh | |
| publish-downloads: | |
| name: Publish to Downloads page | |
| runs-on: ubuntu-latest | |
| needs: [approval, build] | |
| if: needs.build.outputs.prerelease == 'false' | |
| steps: | |
| - name: Check out Nethermind repository | |
| uses: actions/checkout@v5 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ${{ github.workspace }}/${{ env.PACKAGE_DIR }} | |
| - name: Configure GPG Key | |
| run: | | |
| mkdir -p ~/.gnupg/ | |
| printf "${{ secrets.GPG_SIGNING_KEY }}" | base64 --decode > ~/.gnupg/private.key | |
| gpg --import --no-tty --batch --yes ~/.gnupg/private.key | |
| - name: Publish packages to Downloads page | |
| env: | |
| DOWNLOADS_PAGE: ${{ secrets.DOWNLOADS_API_KEY }} | |
| PACKAGE_PREFIX: ${{ needs.build.outputs.package-prefix }} | |
| PASS: ${{ secrets.GPG_PASSWORD }} | |
| run: | | |
| cp $GITHUB_WORKSPACE/$PACKAGE_DIR/**/*.zip $GITHUB_WORKSPACE/$PACKAGE_DIR | |
| rm -rf $GITHUB_WORKSPACE/$PACKAGE_DIR/*/ | |
| $SCRIPTS_PATH/publish-downloads.sh | |
| publish-docker: | |
| name: Publish to Docker Hub | |
| runs-on: ubuntu-latest | |
| needs: [approval, build] | |
| steps: | |
| - name: Check out Nethermind repository | |
| uses: actions/checkout@v5 | |
| - name: Authenticate App | |
| id: gh-app | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ vars.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
| - name: Build and push image to Docker Hub | |
| run: | | |
| image=nethermind/nethermind | |
| for suffix in "" ".chiseled"; do | |
| tag_suffix=$([[ -z "$suffix" ]] && echo "" || echo "-${suffix:1}") | |
| docker buildx build . --platform=linux/amd64,linux/arm64 -f Dockerfile$suffix \ | |
| ${{ needs.build.outputs.prerelease == 'false' && '-t $image:latest$tag_suffix' || '' }} \ | |
| -t "$image:${{ needs.build.outputs.version }}$tag_suffix" \ | |
| --build-arg CI=$CI \ | |
| --build-arg COMMIT_HASH=$GITHUB_SHA \ | |
| --build-arg SOURCE_DATE_EPOCH=$(git log -1 --format=%ct) \ | |
| --push | |
| done |