-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Add GitHub workflow to run goreleaser #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| name: goreleaser | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - 'main' | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
|
|
||
| # - name: Debug | ||
| # run: | | ||
| # printenv | sort | ||
|
|
||
| - name: Test | ||
| run: go test -v ./... | ||
|
|
||
| build: | ||
| name: Build Release | ||
| needs: [ test ] | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
|
|
||
| - name: Run GoReleaser | ||
| uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| distribution: goreleaser | ||
| version: latest | ||
| args: release --clean --skip=validate --skip=publish | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| release: | ||
| name: Release and publish | ||
| needs: [ test ] | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
|
|
||
| - name: Run GoReleaser | ||
| uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| distribution: goreleaser | ||
| version: latest | ||
| args: release --clean | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GORELEASER_CURRENT_TAG: ${{ github.ref_name }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| *~ | ||
| /dist/ | ||
| /hemlock-sendmsg | ||
| /hemlock-sendmsg.exe | ||
| /secrets/* | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| version: 2 | ||
|
|
||
| env: | ||
| - GO111MODULE=on | ||
|
|
||
| before: | ||
| hooks: | ||
| - go mod download | ||
|
|
||
| builds: | ||
| - main: ./... | ||
| env: | ||
| - CGO_ENABLED=0 | ||
| goos: | ||
| - linux | ||
| goarch: | ||
| - amd64 | ||
|
Comment on lines
+10
to
+17
|
||
|
|
||
| archives: | ||
| - files: | ||
| - README.md | ||
|
|
||
| release: | ||
| prerelease: auto | ||
|
|
||
| changelog: | ||
| sort: asc | ||
| filters: | ||
| exclude: | ||
| - '^docs:' | ||
| - '^test:' | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the PR build job,
goreleaser release --skip=publishis still a full release flow and typically requires a tag; on pull requests this commonly fails unless--snapshotis used (orgoreleaser buildis run instead). Consider switching this to a snapshot build to validate packaging on PRs without needing tags.