-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update goreleaser, add release GitHub Action
- Loading branch information
Showing
3 changed files
with
100 additions
and
41 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
goreleaser: | ||
name: Run GoReleaser | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
- name: Install upx 3.96 | ||
run: | | ||
wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz | ||
tar -xf upx-3.96-amd64_linux.tar.xz | ||
mv ./upx-3.96-amd64_linux/upx /usr/local/bin/upx | ||
upx -V | ||
- name: Docker Login | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ scripts/ | |
codeowners-validator | ||
dist/ | ||
tmp/ | ||
coverage.txt | ||
bin/ | ||
coverage.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,64 @@ | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
hooks: | ||
# Install upx first, https://github.com/upx/upx/releases | ||
post: ./hack/compress.sh | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
goarch: | ||
- amd64 | ||
- 386 | ||
ldflags: | ||
- -s -w -X github.com/mszostok/codeowners-validator/pkg/version.version={{.Version}} -X github.com/mszostok/codeowners-validator/pkg/version.commit={{.ShortCommit}} -X github.com/mszostok/codeowners-validator/pkg/version.buildDate={{.Date}} | ||
# List of combinations of GOOS + GOARCH + GOARM to ignore. | ||
# Default is empty. | ||
ignore: | ||
- goos: darwin | ||
goarch: 386 | ||
archive: | ||
replacements: | ||
darwin: Darwin | ||
linux: Linux | ||
windows: Windows | ||
386: i386 | ||
amd64: x86_64 | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ .Tag }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
- id: codeowners-validator | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
goarch: | ||
- "386" | ||
- amd64 | ||
- arm64 | ||
ldflags: | ||
- -s -w -X github.com/mszostok/codeowners-validator/pkg/version.version={{.Version}} -X github.com/mszostok/codeowners-validator/pkg/version.commit={{.ShortCommit}} -X github.com/mszostok/codeowners-validator/pkg/version.buildDate={{.Date}} | ||
# List of combinations of GOOS + GOARCH + GOARM to ignore. | ||
# Default is empty. | ||
ignore: | ||
- goos: windows # due to upx error: CantPackException: can't pack new-exe | ||
goarch: arm64 | ||
hooks: | ||
# Install upx first, https://github.com/upx/upx/releases | ||
post: upx -9 "{{ .Path }}" | ||
|
||
archives: | ||
- format: binary | ||
name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}" | ||
|
||
dockers: | ||
- dockerfile: Dockerfile | ||
binaries: | ||
ids: | ||
- codeowners-validator | ||
image_templates: | ||
- "ghcr.io/mszostok/codeowners-validator:stable" | ||
- "ghcr.io/mszostok/codeowners-validator:{{ .Tag }}" | ||
- "ghcr.io/mszostok/codeowners-validator:v{{ .Major }}.{{ .Minor }}" | ||
- "ghcr.io/mszostok/codeowners-validator:v{{ .Major }}" | ||
- "mszostok/codeowners-validator:latest" | ||
- "mszostok/codeowners-validator:{{ .Tag }}" | ||
- "mszostok/codeowners-validator:v{{ .Major }}.{{ .Minor }}" | ||
|
||
checksum: | ||
name_template: 'checksums.txt' | ||
|
||
snapshot: | ||
name_template: "{{ .Tag }}-next" | ||
|
||
changelog: | ||
use: github | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
|
||
dist: bin | ||
|
||
release: | ||
# If set to true, will not auto-publish the release. | ||
# Default is false. | ||
draft: true | ||
# Repo in which the release will be created. | ||
# Default is extracted from the origin remote URL or empty if its private hosted. | ||
github: | ||
owner: mszostok | ||
name: codeowners-validator |