Skip to content

Commit

Permalink
Update releaser.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
iTanken authored Apr 19, 2024
1 parent c3bc69b commit 681ec00
Showing 1 changed file with 37 additions and 29 deletions.
66 changes: 37 additions & 29 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,47 @@ on:
tags:
- "v*"

permissions:
contents: write

jobs:
goreleaser:
strategy:
matrix:
go-version: [1.20.x]
go-version: [1.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Cache-Go
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod # Module download cache
~/.cache/go-build # Build cache (Linux)
~/Library/Caches/go-build # Build cache (Mac)
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Test
run: go test ./...
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Cache-Go
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod # Module download cache
~/.cache/go-build # Build cache (Linux)
~/Library/Caches/go-build # Build cache (Mac)
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Test
run: go test ./...

- name: Get Tag Name
id: tag
run: echo "tagName=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

- name: Create Release
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 681ec00

Please sign in to comment.