Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: release

on:
push:
tags:
- "*"
merge_group:
types: [checks_requested]

jobs:
release:
runs-on:
group: databricks-deco-testing-runner-group
labels: ubuntu-latest-deco

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

# The default cache key for this action considers only the `go.sum` file.
# We include .goreleaser.yaml here to differentiate from the cache used by the push action
# that runs unit tests. This job produces and uses a different cache.
cache-dependency-path: |
go.sum
.goreleaser.yml


- name: Write release notes to file
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
RELEASE_NOTES_DIR=/tmp/release-notes
mkdir -p "$RELEASE_NOTES_DIR"
RELEASE_NOTES_FILE="$RELEASE_NOTES_DIR/release-notes.md"
git for-each-ref --format='%(body)' ${{ github.ref }} > "$RELEASE_NOTES_FILE"
echo "Release notes file: $RELEASE_NOTES_FILE"
echo "Release notes contents:"
cat "$RELEASE_NOTES_FILE"
else
echo "Not a release tag, skipping release notes"
fi

- name: Run GoReleaser (Release)
uses: goreleaser/goreleaser-action@v6
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
version: ~> v2
# Arguments cannot reference environment variables, so we write the release notes
# to a well-known location and use that in the goreleaser command.
args: release --clean --release-notes=/tmp/release-notes/release-notes.md
env:
# use GITHUB_TOKEN that is already available in secrets.GITHUB_TOKEN
# https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run GoReleaser (Snapshot)
uses: goreleaser/goreleaser-action@v6
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
with:
version: ~> v2
args: release --clean --snapshot
env:
# use GITHUB_TOKEN that is already available in secrets.GITHUB_TOKEN
# https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2

before:
hooks:
- go mod download

builds:
- skip: true

# Snapshot configuration for non-release builds
snapshot:
version_template: "{{ .Tag }}"

# Changelog configuration (overridden by workflow with tag message)
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

release: {}
Loading