Skip to content

update workflows to account for new dbt-tests-adapter structure #95

update workflows to account for new dbt-tests-adapter structure

update workflows to account for new dbt-tests-adapter structure #95

Workflow file for this run

name: "Release"
run-name: "Release ${{ inputs.package }}==${{ inputs.version_number }} to ${{ inputs.deploy-to }}"
on:
workflow_dispatch:
inputs:
package:
description: "Choose what to publish"
type: choice
options:
- dbt-adapters
- dbt-tests-adapter
version_number:
description: "The release version number (i.e. 1.0.0b1)"
type: string
required: true
deploy-to:
description: "Choose where to publish"
type: choice
options:
- prod
- test
default: prod
nightly_release:
description: "Nightly release to dev environment"
type: boolean
default: false
target_branch:
description: "The branch to release from"
type: string
default: main
workflow_call:
inputs:
package:
description: "Choose what to publish"
type: string
required: true
version_number:
description: "The release version number (i.e. 1.0.0b1)"
type: string
required: true
deploy-to:
description: "Choose where to publish"
type: string
default: prod
nightly_release:
description: "Nightly release to dev environment"
type: boolean
default: false
target_branch:
description: "The branch to release from"
type: string
default: main
# this is the permission that allows creating a new release
permissions:
contents: write
id-token: write
# 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.package }}-${{ inputs.deploy-to }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
bump-version-generate-changelog-dbt-adapters:
name: "Bump package version, Generate changelog - dbt-adapters"
uses: .github/workflows/release_prep_hatch.yml

Check failure on line 73 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

invalid value workflow reference: no version specified
with:
version_number: ${{ inputs.version_number }}
deploy_to: ${{ inputs.deploy-to }}
nightly_release: ${{ inputs.nightly_release }}
target_branch: ${{ inputs.target_branch }}
run-unit-tests: true
secrets: inherit
bump-version-generate-changelog-dbt-tests-adapter:
name: "Bump package version, Generate changelog - dbt-tests-adapter"
uses: .github/workflows/release_prep_hatch.yml
with:
version_number: ${{ inputs.version_number }}
deploy_to: ${{ inputs.deploy-to }}
nightly_release: ${{ inputs.nightly_release }}
target_branch: ${{ inputs.target_branch }}
working-dir: "./dbt-tests-adapter"
secrets: inherit
log-outputs-bump-version-generate-changelog:
name: "[Log output] Bump package version, Generate changelog"
if: ${{ !failure() && !cancelled() }}
needs: [bump-version-generate-changelog]
runs-on: ubuntu-latest
steps:
- name: Print variables
run: |
echo Final SHA : ${{ needs.bump-version-generate-changelog.outputs.final_sha }}
echo Changelog path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }}
build-and-test:
name: "Build and Test"
needs: [log-outputs-bump-version-generate-changelog, bump-version-generate-changelog]
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: "Check out repository"
uses: actions/checkout@v4
with:
ref: ${{ needs.bump-version-generate-changelog.outputs.final_sha }}
- name: "Setup `hatch`"
uses: .github/actions/setup-hatch
- name: "Build `dbt-adapters`"
if: ${{ inputs.package == 'dbt-adapters' }}
uses: .github/actions/build-hatch
with:
changelog-path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }}
archive-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }}
- name: "Build `dbt-tests-adapter`"
if: ${{ inputs.package == 'dbt-tests-adapter' }}
uses: .github/actions/build-hatch
with:
changelog-path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }}
archive-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }}
working-dir: "./dbt-tests-adapter/"
github-release:
name: "GitHub Release"
# ToDo: update GH release to handle adding dbt-tests-adapter and dbt-adapter assets to the same release
if: ${{ !failure() && !cancelled() && inputs.package == 'dbt-adapters' }}
needs: [build-and-test, bump-version-generate-changelog]
uses: .github/workflows/github-release.yml
with:
sha: ${{ needs.bump-version-generate-changelog.outputs.final_sha }}
version_number: ${{ inputs.version_number }}
changelog_path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }}
test_run: ${{ inputs.deploy-to == 'test' && true || false }}
archive_name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }}
pypi-release:
name: "Publish to PyPI"
runs-on: ubuntu-latest
if: ${{ !failure() && !cancelled() }}
needs: [github-release]
environment:
name: ${{ inputs.deploy-to }}
url: ${{ vars.PYPI_PROJECT_URL }}
steps:
- name: "Check out repository"
uses: actions/checkout@v4
- name: "Publish to PyPI"
uses: .github/actions/publish-pypi
with:
archive-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }}
repository-url: ${{ vars.PYPI_REPOSITORY_URL }}