diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d5227aa..75fe935 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: diff --git a/.gitignore b/.gitignore index 0060276..a52a788 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,5 @@ bin # Package Files *.war -*.ear \ No newline at end of file +*.ear +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..e858636 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,38 @@ +project_name: etcdkeeper + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + ignore: + - goos: darwin + goarch: amd64 + - 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:'