From db2eb9ef177d7fcd55c832a3f1f9993b7b19bd4a Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Tue, 17 Dec 2024 11:21:44 -0600 Subject: [PATCH 1/5] Debugging the release workflow --- .github/workflows/release.yaml | 51 ++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 60b479e8..8ad24789 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,6 +3,7 @@ on: pull_request: types: [closed] branches: [master] + workflow_dispatch: inputs: releaseType: @@ -24,6 +25,9 @@ jobs: pull-requests: read contents: write runs-on: ubuntu-latest + outputs: + release-kind: ${{ steps.release-kind.outputs.release-kind }} + package: ${{ steps.bump-version.outputs.package }} steps: - uses: actions/checkout@v4 name: Checkout the repository @@ -45,8 +49,6 @@ jobs: RELEASE_KIND=$(generate-changelog --output release-hint) echo "::notice::Suggested release type for this branch is: ${RELEASE_KIND}" echo "RELEASE_KIND=$RELEASE_KIND" >> $GITHUB_ENV - echo "release-kind=$RELEASE_KIND" >> $GITHUB_OUTPUT - echo "PACKAGE=false" >> $GITHUB_ENV - name: Override release kind on manual if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.releaseType != 'auto' }} @@ -54,7 +56,11 @@ jobs: run: | echo "::notice::Overriding release type to ${{ github.event.inputs.releaseType }} since this was a manual trigger" echo "RELEASE_KIND=${{ github.event.inputs.releaseType }}" >> $GITHUB_ENV - echo "release-kind=${{ github.event.inputs.releaseType }}" >> $GITHUB_OUTPUT + + - name: Output release kind + id: release-kind + run: | + echo "release-kind=$RELEASE_KIND" >> $GITHUB_OUTPUT - name: Get Pull Request Number id: pr @@ -67,15 +73,17 @@ jobs: GITHUB_TOKEN: ${{ secrets.PAT }} - name: Bump version - if: ${{ env.RELEASE_KIND != 'no-release' }} + id: bump-version shell: bash run: | case "$RELEASE_KIND" in + no-release) + echo "PACKAGE=false" >> $GITHUB_ENV major|minor|patch) bump-my-version bump --allow-dirty --verbose "$RELEASE_KIND" echo "TAG_NAME=$(bump-my-version show current_version)" >> $GITHUB_ENV - git push - git push --tags + # git push + # git push --tags echo "PACKAGE=true" >> $GITHUB_ENV ;; dev) @@ -84,6 +92,8 @@ jobs: ;; esac + echo "package=PACKAGE" >> $GITHUB_OUTPUT + - name: Package and upload artifacts if: ${{ env.PACKAGE == 'true' }} uses: ./.github/actions/package-and-upload-artifacts @@ -91,7 +101,8 @@ jobs: tag-name: ${{ env.TAG_NAME }} release: - if: ${{ env.PACKAGE == 'true' }} + if: needs.version.outputs.package == 'true' + needs: version runs-on: ubuntu-latest permissions: id-token: write @@ -109,17 +120,15 @@ jobs: with: name: release-notes - - name: Create a GitHub release - uses: softprops/action-gh-release@v1 - with: - files: dist/* - tag_name: "${{ env.TAG_NAME }}" - body_path: release-notes.md - - - name: Upload package to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - - - name: Create a GitHub release - uses: ./.github/actions/release - with: - tag-name: ${{ env.TAG_NAME }} + - name: show env + run: | + echo ${{ env.TAG_NAME }} +# - name: Create a GitHub release +# uses: softprops/action-gh-release@v1 +# with: +# files: dist/* +# tag_name: "${{ env.TAG_NAME }}" +# body_path: release-notes.md +# +# - name: Upload package to PyPI +# uses: pypa/gh-action-pypi-publish@release/v1 From 56dfac09a191d3a519bf2de6c0a0b6d0c4e456ba Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Tue, 17 Dec 2024 11:30:39 -0600 Subject: [PATCH 2/5] Fixed syntax errors in scripts --- .github/workflows/release.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8ad24789..b65cc9cf 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -60,7 +60,7 @@ jobs: - name: Output release kind id: release-kind run: | - echo "release-kind=$RELEASE_KIND" >> $GITHUB_OUTPUT + echo "release-kind=${{ env.RELEASE_KIND }}" >> $GITHUB_OUTPUT - name: Get Pull Request Number id: pr @@ -69,16 +69,14 @@ jobs: echo "pull_request_number=${PR_NUMBER}" >> $GITHUB_OUTPUT echo "::notice::PR_NUMBER is ${PR_NUMBER}" echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV - env: - GITHUB_TOKEN: ${{ secrets.PAT }} +# env: +# GITHUB_TOKEN: ${{ secrets.PAT }} - name: Bump version id: bump-version shell: bash run: | case "$RELEASE_KIND" in - no-release) - echo "PACKAGE=false" >> $GITHUB_ENV major|minor|patch) bump-my-version bump --allow-dirty --verbose "$RELEASE_KIND" echo "TAG_NAME=$(bump-my-version show current_version)" >> $GITHUB_ENV @@ -90,9 +88,11 @@ jobs: bump-my-version bump --allow-dirty --verbose --no-commit --no-tag "$RELEASE_KIND" echo "PACKAGE=true" >> $GITHUB_ENV ;; + *) + echo "PACKAGE=false" >> $GITHUB_ENV esac - echo "package=PACKAGE" >> $GITHUB_OUTPUT + echo "package=${{ env.PACKAGE }}" >> $GITHUB_OUTPUT - name: Package and upload artifacts if: ${{ env.PACKAGE == 'true' }} From 76c31c419759d15d8ea74fce94cee5353056ba76 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Tue, 17 Dec 2024 11:34:49 -0600 Subject: [PATCH 3/5] Fixed PACKAGE env variable --- .github/workflows/release.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b65cc9cf..655147d1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -83,16 +83,19 @@ jobs: # git push # git push --tags echo "PACKAGE=true" >> $GITHUB_ENV + export PACKAGE=true ;; dev) bump-my-version bump --allow-dirty --verbose --no-commit --no-tag "$RELEASE_KIND" echo "PACKAGE=true" >> $GITHUB_ENV + export PACKAGE=true ;; *) echo "PACKAGE=false" >> $GITHUB_ENV + export PACKAGE=false esac - echo "package=${{ env.PACKAGE }}" >> $GITHUB_OUTPUT + echo "package=$PACKAGE" >> $GITHUB_OUTPUT - name: Package and upload artifacts if: ${{ env.PACKAGE == 'true' }} From 0e773ecc5812a066b8c0f049a597e092722f138b Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Tue, 17 Dec 2024 11:45:31 -0600 Subject: [PATCH 4/5] Fixed tag-name output --- .github/workflows/release.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 655147d1..900864ee 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -28,6 +28,7 @@ jobs: outputs: release-kind: ${{ steps.release-kind.outputs.release-kind }} package: ${{ steps.bump-version.outputs.package }} + tag-name: ${{ steps.bump-version.outputs.tag-name }} steps: - uses: actions/checkout@v4 name: Checkout the repository @@ -80,6 +81,7 @@ jobs: major|minor|patch) bump-my-version bump --allow-dirty --verbose "$RELEASE_KIND" echo "TAG_NAME=$(bump-my-version show current_version)" >> $GITHUB_ENV + export "TAG_NAME=$(bump-my-version show current_version)" # git push # git push --tags echo "PACKAGE=true" >> $GITHUB_ENV @@ -96,6 +98,7 @@ jobs: esac echo "package=$PACKAGE" >> $GITHUB_OUTPUT + echo "tag-name=$TAG_NAME" >> $GITHUB_OUTPUT - name: Package and upload artifacts if: ${{ env.PACKAGE == 'true' }} @@ -125,12 +128,12 @@ jobs: - name: show env run: | - echo ${{ env.TAG_NAME }} + echo ${{ needs.version.outputs.tag-name }} # - name: Create a GitHub release # uses: softprops/action-gh-release@v1 # with: # files: dist/* -# tag_name: "${{ env.TAG_NAME }}" +# tag_name: "${{ needs.version.outputs.tag-name }}" # body_path: release-notes.md # # - name: Upload package to PyPI From c0e7ad4b84bcac847039b02ed245b3b9b2b37200 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Tue, 17 Dec 2024 11:48:51 -0600 Subject: [PATCH 5/5] Removed debug stuff --- .github/workflows/release.yaml | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 900864ee..137aa5bd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -70,8 +70,6 @@ jobs: echo "pull_request_number=${PR_NUMBER}" >> $GITHUB_OUTPUT echo "::notice::PR_NUMBER is ${PR_NUMBER}" echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV -# env: -# GITHUB_TOKEN: ${{ secrets.PAT }} - name: Bump version id: bump-version @@ -82,8 +80,8 @@ jobs: bump-my-version bump --allow-dirty --verbose "$RELEASE_KIND" echo "TAG_NAME=$(bump-my-version show current_version)" >> $GITHUB_ENV export "TAG_NAME=$(bump-my-version show current_version)" - # git push - # git push --tags + git push + git push --tags echo "PACKAGE=true" >> $GITHUB_ENV export PACKAGE=true ;; @@ -126,15 +124,12 @@ jobs: with: name: release-notes - - name: show env - run: | - echo ${{ needs.version.outputs.tag-name }} -# - name: Create a GitHub release -# uses: softprops/action-gh-release@v1 -# with: -# files: dist/* -# tag_name: "${{ needs.version.outputs.tag-name }}" -# body_path: release-notes.md -# -# - name: Upload package to PyPI -# uses: pypa/gh-action-pypi-publish@release/v1 + - name: Create a GitHub release + uses: softprops/action-gh-release@v1 + with: + files: dist/* + tag_name: "${{ needs.version.outputs.tag-name }}" + body_path: release-notes.md + + - name: Upload package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1