Skip to content

Commit

Permalink
fix: Use goreleaser for publishing
Browse files Browse the repository at this point in the history
docs: update readme
ci: update release workflow to add goreleaser action
  • Loading branch information
Nicconike committed Jul 8, 2024
1 parent a0e882b commit 8fa9fc1
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 11 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Release
on:
push:
branches: master
pull_request:
branches: master

jobs:
release:
Expand Down Expand Up @@ -32,9 +30,6 @@ jobs:
with:
go-version: "1.22.x"

- name: Build
run: go build ./...

- name: Run Semantic Release
uses: go-semantic-release/action@v1
id: semrel
Expand All @@ -44,10 +39,18 @@ jobs:
update-file: go.mod
changelog-generator-opt: "emojis=true"

- name: Publish to GitHub
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
if: steps.semrel.outputs.version != ''
with:
distribution: releaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
GORELEASER_CURRENT_TAG: ${{ steps.semrel.outputs.version }}

- name: Update pkg.go.dev
if: steps.semrel.outputs.version != ''
run: |
VERSION=$(git describe --tags --abbrev=0)
echo "module github.com/Nicconike/goautomate" > go.mod
GOPROXY=proxy.golang.org go list -m github.com/Nicconike/goautomate@$VERSION
go list -m github.com/Nicconike/goautomate@${{ steps.semrel.outputs.version }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ vendor/
# Go workspace file
go.work
go.work.sum

dist/
38 changes: 38 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
project_name: goautomate

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
main: ./cmd/goautomate

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
format_overrides:
- goos: windows
format: zip

changelog:
disable: true
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

release:
github:
owner: Nicconike
name: goautomate
26 changes: 26 additions & 0 deletions .semrelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"plugins": {
"commit-analyzer": {
"name": "default"
},
"changelog-generator": {
"name": "default",
"options": {
"emojis": true
}
},
"files-updater": {
"name": "default",
"files": [
{
"path": "CHANGELOG.md",
"type": "changelog"
},
{
"path": "go.mod",
"type": "go-mod"
}
]
}
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ This will check the specified file for the current Go version, compare it with t

## Supported File Types

goautomate can extract Go versions from various file types, including:
`goautomate` can extract Go versions from various file types, including:

- Dockerfile
- go.mod
Expand All @@ -79,7 +79,7 @@ goautomate can extract Go versions from various file types, including:

The tool uses various patterns to detect Go versions, making it flexible for different project setups.

Missing any file types you expected to see? Let me know through [discussions](https://github.com/Nicconike/goautomate/discussions).
Missing any file types you expected to see? Let me know via [discussions](https://github.com/Nicconike/goautomate/discussions).

## Contributing

Expand Down
Binary file modified assets/gomod_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8fa9fc1

Please sign in to comment.