Skip to content

Commit

Permalink
add goreleaser to github workflow release asset
Browse files Browse the repository at this point in the history
  • Loading branch information
RouxAntoine committed Aug 26, 2021
1 parent 3bb5590 commit 73edf54
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 11 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,39 @@ jobs:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
-
name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
-
name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
-
name: Tests
run: |
cd ./src/etcdkeeper
go mod tidy
go test -v ./...
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Duplication with docker.yml workflow cause the previous automatic release don't trigger a release created event
docker:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ bin

# Package Files
*.war
*.ear
*.ear
dist/
36 changes: 36 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
project_name: etcdkeeper

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
dir: ./src/etcdkeeper
archives:
- replacements:
386: i386
amd64: x86_64
format: zip
name_template: "{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}_{{ .Arch }}"
wrap_in_directory: true
files:
- LICENSE
- README.md
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-snapshot"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

0 comments on commit 73edf54

Please sign in to comment.