Skip to content

Commit

Permalink
pull branch through to release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed May 2, 2024
1 parent 5be5dba commit e67d140
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,16 @@ on:
type: string
deploy-to:
description: "Deploy to test or prod"
type: choice
options:
- prod
- test
type: environment
default: prod
ref:
description: "The ref (sha or branch name) to use"
type: string
default: "main"
required: true
only_docker:
description: "Only release Docker image, skip GitHub & PyPI"
type: boolean
default: false
required: false

permissions:
contents: write # this is the permission that allows creating a new release
Expand Down Expand Up @@ -57,7 +52,7 @@ jobs:
- name: "Checkout ${{ github.repository }}@${{ inputs.branch }}"
uses: actions/checkout@v4
with:
ref: "${{ inputs.ref }}"
ref: ${{ needs.release-prep.outputs.release-branch }}
persist-credentials: false

- name: "Setup `hatch`"
Expand Down Expand Up @@ -87,7 +82,7 @@ jobs:
- name: "Publish to PyPI"
uses: dbt-labs/dbt-adapters/.github/actions/publish-pypi@main
with:
pypi-repository-url: ${{ vars.PYPI_REPOSITORY_URL }}
repository-url: ${{ vars.PYPI_REPOSITORY_URL }}
archive-name: ${{ needs.build-release.outputs.archive-name }}

github-release:
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/release_prep_hatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ on:
type: boolean
default: false
outputs:
release-branch:
description: "The branch to be released from"
value: ${{ jobs.release.outputs.branch }}
release-sha:
description: "The SHA to be released"
value: ${{ jobs.release-sha.outputs.sha }}
value: ${{ jobs.release.outputs.sha }}
changelog-path:
description: "The path to the changelog from the repo root for this version, e.g. .changes/1.8.0-b1.md"
value: ${{ jobs.release-inputs.outputs.changelog-path }}
Expand Down Expand Up @@ -392,7 +395,7 @@ jobs:
message="Merge ${{ needs.release-branch.outputs.name }} into ${{ inputs.branch }}"
echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message"
release-sha:
release:
runs-on: ubuntu-latest
needs:
- release-branch
Expand All @@ -404,11 +407,12 @@ jobs:
# Otherwise, we generated a changelog and/or did the version bump in this workflow and there is a
# new sha to use from the merge we just did. Grab that here instead.
outputs:
branch: ${{ steps.release-branch.outputs.name }}
sha: ${{ steps.release-sha.outputs.sha }}

steps:
- name: "Set release branch"
id: release-branch
id: branch
run: |
branch=""
if [ ${{ inputs.deploy-to == 'test' }} ] || [ ${{ inputs.is-nightly-release == 'true' }} ]
Expand All @@ -419,16 +423,16 @@ jobs:
fi
echo "name=$branch" >> $GITHUB_OUTPUT
- name: "Checkout ${{ github.repository }}@${{ steps.release-branch.outputs.name }}"
- name: "Checkout ${{ github.repository }}@${{ steps.branch.outputs.name }}"
uses: actions/checkout@v3
with:
ref: ${{ steps.release-branch.outputs.name }}
ref: ${{ steps.branch.outputs.name }}

- name: "Set release SHA"
id: release-sha
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT

# if this is a real release and a release branch was created, delete it
- name: "Delete release branch: ${{ needs.release-branch.outputs.name }}"
- name: "Delete release branch: ${{ needs.branch.outputs.name }}"
if: ${{ inputs.deploy-to == 'prod' && inputs.is-nightly-release == 'false' && needs.release-branch.outputs.name != '' }}
run: git push origin -d ${{ needs.release-branch.outputs.name }}
run: git push origin -d ${{ needs.branch.outputs.name }}

0 comments on commit e67d140

Please sign in to comment.