-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat(publish): compile Windows release on Windows #806
Changes from 1 commit
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
name: Test and Release Go CLI | ||
|
||
on: | ||
push: | ||
on: [push] | ||
|
||
jobs: | ||
tests: | ||
|
@@ -13,13 +12,13 @@ jobs: | |
with: | ||
go-version-file: "go.mod" | ||
check-latest: true | ||
- run: go version | ||
cache: true | ||
- name: Execute the tests | ||
run: go test -race ./... | ||
|
||
release: | ||
releases: | ||
needs: tests | ||
name: GoReleaser Build | ||
name: GoReleaser Build on All OS but Windows | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -30,11 +29,36 @@ jobs: | |
with: | ||
go-version-file: "go.mod" | ||
check-latest: true | ||
- run: go version | ||
cache: true | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
releases-windows: | ||
needs: tests | ||
name: GoReleaser Build on Windows | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # See: https://goreleaser.com/ci/actions/ | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: "go.mod" | ||
check-latest: true | ||
cache: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity, what is the use of this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/actions/setup-go#caching-dependency-files-and-build-outputs
It should speed up a bit the CI execution. |
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
version: latest | ||
args: release --config .goreleaser-windows.yaml --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: List files in the repository | ||
run: | | ||
ls ${{ github.workspace }}/dist | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this debug? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oups, yes |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# We need a specific GoRelease file for Windows because we don't want to use Go cross compile feature. We prefer compiling on an actual Windows. | ||
before: | ||
hooks: | ||
- go mod tidy | ||
builds: | ||
- id: scalingo | ||
binary: scalingo | ||
main: ./scalingo | ||
goos: | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- 386 | ||
|
||
# Custom ldflags templates. | ||
# https://goreleaser.com/customization/templates/ | ||
ldflags: -X main.buildstamp={{.Date}} | ||
-X main.githash={{.FullCommit}} | ||
|
||
archives: | ||
- name_template: 'scalingo_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}' | ||
wrap_in_directory: true | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
checksum: | ||
name_template: "checksums_windows.txt" | ||
changelog: | ||
use: github-native | ||
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.
This is just a way to write the same things with a different syntax, and I prefer this one.