|
| 1 | +# This workflow will publish a github release for op-geth |
| 2 | + |
| 3 | +name: Publish |
| 4 | +run-name: ${{ github.actor }} is publishing an op-geth release 🚀 |
| 5 | +on: |
| 6 | + push: |
| 7 | + tags: |
| 8 | + - 'v*' |
| 9 | + |
| 10 | +# Always wait for previous release to finish before releasing again |
| 11 | +concurrency: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + os: [ubuntu-latest, macos-latest] |
| 20 | + arch: [amd64, arm64] |
| 21 | + exclude: |
| 22 | + - os: ubuntu-latest |
| 23 | + arch: arm64 |
| 24 | + env: |
| 25 | + BUILD_DIR: op-geth.${{ github.ref_name }} |
| 26 | + BIN_DIR: op-geth.${{ github.ref_name }}/build/bin |
| 27 | + FILE_NAME: op-geth.${{ github.ref_name }}.${{ matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }}-${{ matrix.arch }}.tar.gz |
| 28 | + steps: |
| 29 | + - name: Checkout code |
| 30 | + uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Setup go |
| 33 | + uses: actions/setup-go@v5 |
| 34 | + with: |
| 35 | + go-version: '1.22.7' |
| 36 | + |
| 37 | + - name: Build |
| 38 | + run: | |
| 39 | + CGO_ENABLED=0 TARGETOS=${{ matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }} TARGETARCH=${{ matrix.arch }} make geth |
| 40 | + mkdir -p ${{ env.BIN_DIR }} |
| 41 | + mv build/bin/geth ${{ env.BIN_DIR }}/ |
| 42 | + tar -czvf ${{ env.FILE_NAME }} ${{ env.BUILD_DIR }} |
| 43 | +
|
| 44 | + - name: Upload artifact |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: ${{ env.FILE_NAME }} |
| 48 | + path: ${{ env.FILE_NAME }} |
| 49 | + |
| 50 | + release: |
| 51 | + needs: build |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - name: Download artifact |
| 55 | + uses: actions/download-artifact@v4 |
| 56 | + |
| 57 | + - name: Create release |
| 58 | + uses: softprops/action-gh-release@v2 |
| 59 | + with: |
| 60 | + tag_name: ${{ github.ref }} |
| 61 | + name: Release ${{ github.ref_name }} |
| 62 | + files: | |
| 63 | + **/* |
| 64 | + fail_on_unmatched_files: true |
| 65 | + generate_release_notes: true |
0 commit comments