Publish snapshot binaries to snapshot release (#329)

## Changes

Publish snapshot binaries to the snapshot release at
https://github.com/databricks/bricks/releases/tag/snapshot.

This means users have a stable URL to find snapshot builds instead of
having to navigate to a particular action run.

## Tests

Manually.
This commit is contained in:
Pieter Noordhuis 2023-04-12 22:16:30 +02:00 committed by GitHub
parent 1fc903943d
commit 6ecf934719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 4 deletions

View File

@ -40,6 +40,9 @@ jobs:
${{ steps.cache.outputs.GOCACHE }}
key: release-${{ runner.os }}-go-${{ steps.go.outputs.go-version }}-${{ hashFiles('go.sum', '.goreleaser.yaml') }}
- name: Hide snapshot tag to outsmart GoReleaser
run: git tag -d snapshot || true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
@ -51,18 +54,41 @@ jobs:
with:
name: bricks_darwin_snapshot
path: |
dist/bricks_darwin_*
dist/bricks_darwin_*/
- name: Upload Linux binaries
uses: actions/upload-artifact@v3
with:
name: bricks_linux_snapshot
path: |
dist/bricks_linux_*
dist/bricks_linux_*/
- name: Upload Windows binaries
uses: actions/upload-artifact@v3
with:
name: bricks_windows_snapshot
path: |
dist/bricks_windows_*
dist/bricks_windows_*/
- name: Update snapshot tag
# Snapshot release may only be updated for commits to the main branch.
# if: github.ref == 'refs/heads/main'
run: |
git tag snapshot
git push origin snapshot --force
- name: Update snapshot release
# Snapshot release may only be updated for commits to the main branch.
# if: github.ref == 'refs/heads/main'
uses: softprops/action-gh-release@v1
with:
name: Snapshot
prerelease: true
tag_name: snapshot
token: ${{ secrets.GITHUB_TOKEN }}
files: |
dist/bricks*.zip

View File

@ -44,7 +44,13 @@ builds:
binary: '{{ .ProjectName }}'
archives:
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
# Include version in archive only for release builds and not for snapshot builds.
# Snapshot archives must have a stable file name such that the artifacts in the nightly
# release are automatically overwritten. If the snapshot version is included in the
# file name then additional logic to clean up older builds would be needed.
name_template: '{{ .ProjectName }}_{{ if not .IsSnapshot }}{{ .Version }}_{{ end }}{{ .Os }}_{{ .Arch }}'
checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256