Skip to content

Commit

Permalink
feat: new release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
christophwitzko committed Feb 3, 2023
1 parent 7da7e83 commit cd9bbb8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 22 deletions.
35 changes: 13 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: golangci/golangci-lint-action@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
- uses: golangci/golangci-lint-action@v3
build:
runs-on: ${{ matrix.os }}
needs: lint
Expand All @@ -20,35 +23,23 @@ jobs:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.19
- run: go build ./cmd/files-updater-helm/
- run: go test -v ./...
release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
- run: |
go install github.com/mitchellh/gox@latest
go install github.com/tcnksm/ghr@latest
go-version: 1.19
- uses: go-semantic-release/action@v1
id: semrel
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
ghr: true
- run: |
gox -parallel 4 -osarch="linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 linux/arm windows/amd64" -ldflags="-extldflags '-static' -s -w -X github.com/go-semantic-release/files-updater-helm/pkg/updater.FUVERSION=${{steps.semrel.outputs.version}}" -output="bin/{{.Dir}}_v${{steps.semrel.outputs.version}}_{{.OS}}_{{.Arch}}" ./cmd/files-updater-helm/
cd bin/ && shasum -a 256 * > ./files-updater-helm_v${{steps.semrel.outputs.version}}_checksums.txt && cd -
if: steps.semrel.outputs.version != ''
env:
CGO_ENABLED: 0
- run: ghr $(cat .ghr) bin/
if: steps.semrel.outputs.version != ''
hooks: goreleaser,plugin-registry-update
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLUGIN_REGISTRY_ADMIN_ACCESS_TOKEN: ${{ secrets.PLUGIN_REGISTRY_ADMIN_ACCESS_TOKEN }}
21 changes: 21 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
builds:
- env:
- CGO_ENABLED=0
targets:
- linux_amd64
- linux_arm64
- darwin_amd64
- darwin_arm64
- linux_arm
- windows_amd64
main: ./cmd/files-updater-helm/
ldflags:
- -extldflags '-static'
- -s -w -X github.com/go-semantic-release/files-updater-helm/pkg/updater.FUVERSION={{.Version}}

archives:
- format: binary
name_template: '{{ .Binary }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}'

checksum:
name_template: '{{ .ProjectName }}_v{{ .Version }}_checksums.txt'

0 comments on commit cd9bbb8

Please sign in to comment.