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
27 changes: 19 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ on:
push:
tags:
- v*
workflow_dispatch:
inputs:
tag:
description: Existing release tag to publish
required: true
type: string

concurrency:
group: release-${{ github.workflow }}-${{ github.ref }}
group: release-${{ github.workflow }}-${{ inputs.tag || github.ref }}
cancel-in-progress: false

jobs:
Expand Down Expand Up @@ -34,6 +40,7 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ inputs.tag || github.ref }}

- name: Install sqlc
uses: sqlc-dev/setup-sqlc@bac53b7fb28c039a6c7f5736fd1e89744021bdd6 # v5.0.0
Expand Down Expand Up @@ -70,12 +77,15 @@ jobs:
timeout-minutes: 15
permissions:
contents: write
env:
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ inputs.tag || github.ref }}

- name: Install Rust stable
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
Expand All @@ -99,18 +109,18 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
if gh release view "${RELEASE_TAG}" >/dev/null 2>&1; then
exit 0
fi

if [[ "${GITHUB_REF_NAME}" == *-* ]]; then
gh release create "${GITHUB_REF_NAME}" \
--title "${GITHUB_REF_NAME}" \
if [[ "${RELEASE_TAG}" == *-* ]]; then
gh release create "${RELEASE_TAG}" \
--title "${RELEASE_TAG}" \
--generate-notes \
--prerelease
else
gh release create "${GITHUB_REF_NAME}" \
--title "${GITHUB_REF_NAME}" \
gh release create "${RELEASE_TAG}" \
--title "${RELEASE_TAG}" \
--generate-notes \
--latest
fi
Expand All @@ -119,7 +129,7 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload "${GITHUB_REF_NAME}" \
gh release upload "${RELEASE_TAG}" \
dist/sqlc-gen-sqlx.wasm \
dist/sqlc-gen-sqlx.wasm.sha256 \
--clobber
Expand All @@ -139,6 +149,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ inputs.tag || github.ref }}

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
Expand Down