Prevent workflow jobs run twice #76
Workflow file for this run
This file contains 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 | |
on: | |
push: | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
# https://github.com/orgs/community/discussions/57827 | |
if: github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != | |
github.event.pull_request.base.repo.full_name | |
steps: | |
- name: Set up Go 1.22 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Test and lint | |
run: | | |
go install honnef.co/go/tools/cmd/staticcheck@latest | |
make test | |
- name: Build | |
run: | | |
echo GITHUB_REF=$GITHUB_REF GITHUB_SHA=$GITHUB_SHA | |
make release | |
- name: Create release and upload assets if tag is defined | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: dist/*.tar.gz |