From e67d1401beab8ec59c2275463601141c4eeca837 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 2 May 2024 10:38:45 -0400 Subject: [PATCH] pull branch through to release workflow --- .github/workflows/release.yml | 11 +++-------- .github/workflows/release_prep_hatch.yml | 18 +++++++++++------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9178a9a5..6c37e515 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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`" @@ -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: diff --git a/.github/workflows/release_prep_hatch.yml b/.github/workflows/release_prep_hatch.yml index 7a0a6d95..7f38d2c3 100644 --- a/.github/workflows/release_prep_hatch.yml +++ b/.github/workflows/release_prep_hatch.yml @@ -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 }} @@ -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 @@ -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' }} ] @@ -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 }}