Release #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
deploy-to: | |
type: choice | |
description: Choose where to publish (test/prod) | |
options: | |
- prod | |
- test | |
default: prod | |
sha: | |
description: "The last commit sha in the release" | |
type: string | |
required: true | |
permissions: | |
contents: write # this is the permission that allows creating a new release | |
# will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }}-${{ inputs.deploy-to }} | |
cancel-in-progress: true | |
jobs: | |
release-inputs: | |
name: Release inputs | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
archive-name: ${{ steps.archive.outputs.name }} | |
changelog-path: ${{ steps.changelog.outputs.path }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Setup `hatch` | |
uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main | |
- name: Set version | |
id: version | |
run: | | |
version=$(hatch version) | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Audit version and parse into parts | |
id: semver | |
uses: dbt-labs/actions/[email protected] | |
with: | |
version: ${{ steps.version.outputs.version }} | |
- name: Set archive name | |
id: archive | |
run: | | |
archive_name=dbt-postgres-$version-${{ inputs.deploy-to }} | |
echo "name=$archive_name" >> $GITHUB_OUTPUT | |
- name: Set changelog path | |
id: changelog | |
shell: bash | |
run: | | |
path=".changes/" | |
if [[ ${{ steps.semver.outputs.is-pre-release }} -eq 1 ]] | |
then | |
path+="${{ steps.semver.outputs.base-version }}-${{ steps.semver.outputs.pre-release }}.md" | |
else | |
path+="${{ steps.semver.outputs.base-version }}.md" | |
fi | |
echo "path=$path" >> $GITHUB_OUTPUT | |
pypi-release: | |
name: PyPI release | |
runs-on: ubuntu-latest | |
needs: [release-inputs] | |
environment: | |
name: ${{ inputs.deploy-to }} | |
url: ${{ vars.PYPI_PROJECT_URL }} | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Setup `hatch` | |
uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main | |
- name: Build `dbt-postgres` | |
uses: dbt-labs/dbt-adapters/.github/actions/build-hatch@main | |
with: | |
archive-name: ${{ needs.release-inputs.outputs.archive-name }} | |
- name: Publish to PyPI | |
uses: dbt-labs/dbt-adapters/.github/actions/publish-pypi@main | |
with: | |
pypi-repository-url: ${{ vars.PYPI_REPOSITORY_URL }} | |
archive-name: ${{ needs.release-inputs.outputs.archive-name }} | |
github-release: | |
name: GitHub release | |
if: ${{ !failure() && !cancelled() }} | |
needs: [release-inputs] | |
uses: dbt-labs/dbt-release/.github/workflows/github-release.yml@main | |
with: | |
sha: ${{ inputs.sha }} | |
version_number: ${{ needs.release-inputs.outputs.version }} | |
changelog_path: ${{ needs.release-inputs.outputs.changelog-path }} | |
test_run: ${{ inputs.deploy-to == 'test' }} | |
docker-release: | |
name: Docker release | |
needs: [release-inputs, github-release] # docker relies on the published tag from github-release | |
if: ${{ !failure() && !cancelled() }} | |
permissions: | |
packages: write | |
uses: dbt-labs/dbt-release/.github/workflows/release-docker.yml@main | |
with: | |
version_number: ${{ needs.release-inputs.outputs.version }} | |
test_run: ${{ inputs.deploy-to == 'test' }} |