diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index defc9c655d..0869fa3563 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -32,85 +32,144 @@ on: branches: - 'release/*' +env: + REPO_NAME: ${{ github.repository_owner }}/beacon-kit + IMAGE_NAME: ${{ github.repository_owner }}/beacon-kit + jobs: - build-linux: + 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: + name: build release + runs-on: ${{ matrix.configs.runs-on }} + needs: extract-version strategy: matrix: - arch: [amd64, arm64] - targetos: [linux] - - name: beacond-${{ matrix.targetos }}-${{ matrix.arch }} + configs: + - arch: arm64 + target-os: linux + runs-on: ubuntu-20.04 + - arch: amd64 + os: ubuntu-20.04 + - arch: arm64 + target-os: darwin + runs-on: macos-14 + build: + - binary: beacond steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: go-version: "^1.22" env: - GOOS: ${{ matrix.targetos }} + GOOS: ${{ matrix.target-os }} GOARCH: ${{ matrix.arch }} - # Build and capture an artifact - - name: Build beacond + - name: Build ${{ matrix.build.binary }} run: | - make build-${{ matrix.targetos }}-${{ matrix.arch }} - + make build-${{ matrix.targetos }}-${{ matrix.arch }}-${{ needs.extract-version.outputs.VERSION }} + tar -czvf ${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.targetos }}-${{ matrix.arch }}.tar.gz -C build/bin . + # Uploads binaries - uses: actions/upload-artifact@v3 with: - name: beacond-${{ matrix.targetos }}-${{ matrix.arch }} + name: beacond-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.targetos }}-${{ matrix.arch }}.tar.gz path: build/bin - build-mac: - runs-on: macos-latest - strategy: - matrix: - arch: [arm64] - targetos: [darwin] - - name: beacond-${{ matrix.targetos }}-${{ matrix.arch }} - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: - go-version: "^1.22" + name: ${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}.tar.gz + path: ${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}.tar.gz + draft-release: + name: draft release + needs: [build, extract-version] + runs-on: ubuntu-latest env: - GOOS: ${{ matrix.targetos }} - GOARCH: ${{ matrix.arch }} - CGO_CFLAGS: "-O -D__BLST_PORTABLE__" - CGO_CFLAGS_ALLOW: "-O -D__BLST_PORTABLE__" + VERSION: ${{ needs.extract-version.outputs.VERSION }} + permissions: + # Required to post the release + contents: write + steps: + # This is necessary for generating the changelog. + # It has to come before "Download Artifacts" or else it deletes the artifacts. + - 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<> $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 }} + # The formatting here is borrowed from Lighthouse (which is borrowed from OpenEthereum): + # https://github.com/openethereum/openethereum/blob/6c2d392d867b058ff867c4373e40850ca3f96969/.github/workflows/build.yml + run: | + body=$(cat <<- "ENDBODY" + ![image](https://github.com/berachain/beacon-kit/blob/main/.github/assets/banner.png?raw=true) + ## Testing Checklist (DELETE ME) - # Build and capture an artifact - - name: Build beacond - run: | - make build-${{ matrix.targetos }}-${{ matrix.arch }} + - [ ] Run on testnet for 1-3 days. + - [ ] Resync a mainnet node. + - [ ] Ensure all CI checks pass. - # Uploads binaries - - uses: actions/upload-artifact@v3 - with: - name: beacond-${{ matrix.targetos }}-${{ matrix.arch }} - path: build/bin + ## Release Checklist (DELETE ME) - draft-release: - runs-on: ubuntu-latest - needs: [build-linux, build-mac] - permissions: write-all - steps: - - name: Checkout repository - uses: actions/checkout@v3 + - [ ] Ensure all crates have had their versions bumped. + - [ ] Write the summary. + - [ ] Fill out the update priority. + - [ ] Ensure all binaries have been added. + - [ ] Prepare release posts (Twitter, ...). - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - path: . + ## Summary - - name: Draft Release - uses: softprops/action-gh-release@v2 - with: - draft: true - files: | - ./beacond-linux-arm64/beacond-linux-arm64 - ./beacond-linux-amd64/beacond-linux-amd64 - ./beacond-darwin-arm64/beacond-darwin-arm64 - env: - GIT_TOKEN: ${{ secrets.DEV_PAT }} + Add a summary, including: + + - Critical bug fixes + - New features + - Any breaking changes (and what to expect) + + ## Update Priority + + This table provides priorities for which classes of users should update particular components. + + | User Class | Priority | + |----------------------|-----------------| + | Payload Builders | | + | Non-Payload Builders | | + + ## All Changes + + ${{ steps.changelog.outputs.CHANGELOG }} + + ## Binaries + + | System | Architecture | Binary | PGP Signature | + |:---:|:---:|:---:|:---| + | | amd64 | [beacond-${{ env.VERSION }}-linux-amd64](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/beacond-${{ env.VERSION }}-amd64-linux.tar.gz) | + | | arm64 | [beacond-${{ env.VERSION }}-linux-arm64](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/beacond-${{ env.VERSION }}-arm64-linux.tar.gz) | + | | arm64 | [beacond-${{ env.VERSION }}-darwin-arm64](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/beacond-${{ env.VERSION }}-darwin-arm64.tar.gz) | + | | | | | + | **System** | **Option** | - | **Resource** | + | | Docker | | [${{ env.IMAGE_NAME }}](https://ghcr.io/berachain/beacon-kit) | + ENDBODY + ) + assets=() + for asset in ./*beacond-*.tar.gz*; do + assets+=("$asset/$asset") + done + tag_name="${{ env.VERSION }}" + echo "$body" | gh release create --draft -t "BeaconKit $tag_name" -F "-" "$tag_name" "${assets[@]}" diff --git a/build/scripts/release.mk b/build/scripts/release.mk index 5e0e4dc3d3..f5ec4cbd49 100644 --- a/build/scripts/release.mk +++ b/build/scripts/release.mk @@ -3,17 +3,19 @@ RELEASE_TARGETS := build-linux-amd64 build-linux-arm64 build-darwin-arm64 define build_release + echo "Building beacond for $(shell echo $(4) | tr '/' '-')-$(1)-$(2)-..." GOOS=$(1) GOARCH=$(2) CGO_ENABLED=$(3) \ cd ${CURRENT_DIR}/$(TESTAPP_CMD_DIR) && \ - go build -mod=readonly $(BUILD_FLAGS) -o $(OUT_DIR)/beacond-$(1)-$(2) ./. + go build -mod=readonly $(BUILD_FLAGS) -o $(OUT_DIR)/beacond-$(shell echo $(4) | tr '/' '-')-$(1)-$(2) ./. endef -build-linux-amd64: - $(call build_release,linux,amd64,0) +build-linux-amd64-%: + $(call build_release,linux,amd64,1,$*) -build-linux-arm64: - $(call build_release,linux,arm64,0) +build-linux-arm64-%: + $(call build_release,linux,arm64,1,$*) + +build-darwin-arm64-%: + $(call build_release,darwin,arm64,1,$*) -build-darwin-arm64: - $(call build_release,darwin,arm64,1)