Merge pull request #60 from ethpandaops/dependabot/github_actions/act… #26
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: Build master | |
| on: | |
| push: | |
| branches: | |
| - 'master' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| check_source: | |
| name: "Run code checks" | |
| uses: ./.github/workflows/_shared-check.yaml | |
| build_binaries: | |
| name: "Build dugtrio" | |
| needs: [check_source] | |
| uses: ./.github/workflows/_shared-build.yaml | |
| with: | |
| release: "snapshot" | |
| docker: true | |
| docker_repository: "ethpandaops/dugtrio" | |
| docker_tag_prefix: "master" | |
| additional_tags: "['master','master-latest']" | |
| secrets: | |
| DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
| DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
| create_snapshot_release: | |
| name: Create snapshot release | |
| needs: [build_binaries] | |
| runs-on: ubuntu-latest | |
| steps: | |
| # download build artifacts | |
| - name: "Download build artifacts" | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| # (re)create snapshot binary release | |
| - name: Update snapshot tag & remove previous snapshot release | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| github-token: ${{secrets.GITHUB_TOKEN}} | |
| script: | | |
| try { | |
| var snapshotTag = "snapshot"; | |
| var snapshotRelease = await github.rest.repos.getReleaseByTag({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| tag: snapshotTag | |
| }); | |
| if(snapshotRelease && snapshotRelease.data && snapshotRelease.data.tag_name == snapshotTag) { | |
| console.log("delete previous snapshot release"); | |
| await github.rest.repos.deleteRelease({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| release_id: snapshotRelease.data.id | |
| }); | |
| } | |
| var snapshotRef = await github.rest.git.getRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: "tags/" + snapshotTag | |
| }); | |
| if(snapshotRef && snapshotRef.data && snapshotRef.data.ref) { | |
| if(snapshotRef.data.object.sha !== context.sha) { | |
| await github.rest.git.updateRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: "tags/" + snapshotTag, | |
| sha: context.sha, | |
| }); | |
| } | |
| } | |
| else { | |
| await github.rest.git.createRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: "tags/" + snapshotTag, | |
| sha: context.sha, | |
| }); | |
| } | |
| } catch (e) { | |
| console.log(e) | |
| } | |
| # generate release artifacts | |
| - name: "Generate release package: dugtrio_snapshot_windows_amd64.zip" | |
| run: | | |
| cd dugtrio_windows_amd64 | |
| zip -r -q ../dugtrio_snapshot_windows_amd64.zip . | |
| - name: "Generate release package: dugtrio_snapshot_linux_amd64.tar.gz" | |
| run: | | |
| cd dugtrio_linux_amd64 | |
| tar -czf ../dugtrio_snapshot_linux_amd64.tar.gz . | |
| - name: "Generate release package: dugtrio_snapshot_linux_arm64.tar.gz" | |
| run: | | |
| cd dugtrio_linux_arm64 | |
| tar -czf ../dugtrio_snapshot_linux_arm64.tar.gz . | |
| - name: "Generate release package: dugtrio_snapshot_darwin_arm64.tar.gz" | |
| run: | | |
| cd dugtrio_darwin_arm64 | |
| tar -czf ../dugtrio_snapshot_darwin_arm64.tar.gz . | |
| - name: Create snapshot release | |
| uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1 | |
| with: | |
| draft: false | |
| prerelease: true | |
| name: "Dev Snapshot" | |
| tag_name: "snapshot" | |
| body: | | |
| ## Latest automatically built executables. (Unstable development snapshot) | |
| Built from master branch (commit: ${{ github.sha }}) | |
| ### Release Artifacts | |
| | Release File | Description | | |
| | ------------- | ------------- | | |
| | [dugtrio_snapshot_windows_amd64.zip](https://github.com/ethpandaops/dugtrio/releases/download/snapshot/dugtrio_snapshot_windows_amd64.zip) | dugtrio executables for windows/amd64 | | |
| | [dugtrio_snapshot_linux_amd64.tar.gz](https://github.com/ethpandaops/dugtrio/releases/download/snapshot/dugtrio_snapshot_linux_amd64.tar.gz) | dugtrio executables for linux/amd64 | | |
| | [dugtrio_snapshot_linux_arm64.tar.gz](https://github.com/ethpandaops/dugtrio/releases/download/snapshot/dugtrio_snapshot_linux_arm64.tar.gz) | dugtrio executables for linux/arm64 | | |
| | [dugtrio_snapshot_darwin_arm64.tar.gz](https://github.com/ethpandaops/dugtrio/releases/download/snapshot/dugtrio_snapshot_darwin_arm64.tar.gz) | dugtrio executable for macos/arm64 | | |
| files: | | |
| dugtrio_snapshot_windows_amd64.zip | |
| dugtrio_snapshot_linux_amd64.tar.gz | |
| dugtrio_snapshot_linux_arm64.tar.gz | |
| dugtrio_snapshot_darwin_arm64.tar.gz |