Skip to content
Merged
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
30 changes: 28 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,26 @@ name: Release

on:
workflow_dispatch:
inputs:
version:
description: >-
Existing version tag to re-publish (e.g. v0.200.0).
Leave empty to bump and release a new version.
required: false

jobs:
release:
if: github.ref == 'refs/heads/main'
# This workflow should always be run on main - this is enforced by the
# `release` environment directly but added here for visibility.
# If the workflow fails during publishing, run a new workflow
# with the `version` that needs to be published.
if: github.ref == 'refs/heads/main' && github.run_attempt == '1'

runs-on: ubuntu-latest
environment: release
permissions:
contents: read

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand All @@ -22,16 +34,30 @@ jobs:
git config user.name "planetscale-actions-bot"
git config user.email "60239337+planetscale-actions-bot@users.noreply.github.com"

- name: Checkout existing tag
if: inputs.version != ''
run: git checkout "refs/tags/$VERSION"
env:
VERSION: ${{ inputs.version }}

- name: Bump version and push tag
if: inputs.version == ''
id: bump
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
run: script/bump-version.sh

- name: Resolve version
id: version
env:
INPUT_VERSION: ${{ inputs.version }}
BUMP_VERSION: ${{ steps.bump.outputs.RELEASE_VERSION }}
run: echo "TAG=${INPUT_VERSION:-$BUMP_VERSION}" >> "$GITHUB_OUTPUT"

- name: Publish artifacts
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ steps.bump.outputs.RELEASE_VERSION }}
GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.TAG }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
AUR_KEY: ${{ secrets.AUR_KEY }}
Expand Down