Work on release actions (#153)

* Include Go version in cache key
* Store build artifacts by operating systems
This commit is contained in:
Pieter Noordhuis 2022-12-22 11:01:50 +01:00 committed by GitHub
parent f5cb9e06a9
commit f3112d90ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 8 deletions

View File

@ -18,6 +18,7 @@ jobs:
run: git fetch --prune --unshallow
- name: Setup Go
id: go
uses: actions/setup-go@v3
with:
go-version: 1.18.8
@ -36,7 +37,7 @@ jobs:
path: |
${{ steps.cache.outputs.GOMODCACHE }}
${{ steps.cache.outputs.GOCACHE }}
key: release-${{ runner.os }}-go-${{ hashFiles('go.sum', '.goreleaser.yaml') }}
key: release-${{ runner.os }}-go-${{ steps.go.outputs.go-version }}-${{ hashFiles('go.sum', '.goreleaser.yaml') }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
@ -44,8 +45,23 @@ jobs:
version: latest
args: release --snapshot
- name: Upload assets
- name: Upload macOS binaries
uses: actions/upload-artifact@v3
with:
name: bricks
path: dist/*.zip
name: bricks_darwin_snapshot
path: |
dist/bricks_darwin_*
- name: Upload Linux binaries
uses: actions/upload-artifact@v3
with:
name: bricks_linux_snapshot
path: |
dist/bricks_linux_*
- name: Upload Windows binaries
uses: actions/upload-artifact@v3
with:
name: bricks_windows_snapshot
path: |
dist/bricks_windows_*

View File

@ -18,6 +18,7 @@ jobs:
run: git fetch --prune --unshallow
- name: Setup Go
id: go
uses: actions/setup-go@v3
with:
go-version: 1.18.8
@ -28,18 +29,18 @@ jobs:
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT
# Note: use custom caching because goreleaser performs a cross platform build
# and therefore we cannot share a cache with the test builds.
# Note: use custom caching because below performs a cross platform build
# through goreleaser and don't want to share a cache with the test builds.
- name: Setup caching
uses: actions/cache@v3
with:
path: |
${{ steps.cache.outputs.GOMODCACHE }}
${{ steps.cache.outputs.GOCACHE }}
key: release-${{ runner.os }}-go-${{ hashFiles('go.sum', '.goreleaser.yaml') }}
key: release-${{ runner.os }}-go-${{ steps.go.outputs.go-version }}-${{ hashFiles('go.sum', '.goreleaser.yaml') }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3.1.0
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist