From d2f30a8e649d099668c03a3e292c2e5a41e3c670 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 17 Dec 2023 09:46:48 -0600 Subject: [PATCH 01/12] Refactored workflows --- .../package-and-upload-artifacts/action.yaml | 45 ++++++++++ .github/actions/release/action.yaml | 37 +++++++++ .github/workflows/release.yaml | 83 ------------------- .github/workflows/{ci.yaml => test.yaml} | 0 ...mpversion-pr.yaml => version-preview.yaml} | 0 .../{bumpversion.yaml => version.yaml} | 8 +- 6 files changed, 88 insertions(+), 85 deletions(-) create mode 100644 .github/actions/package-and-upload-artifacts/action.yaml create mode 100644 .github/actions/release/action.yaml delete mode 100644 .github/workflows/release.yaml rename .github/workflows/{ci.yaml => test.yaml} (100%) rename .github/workflows/{bumpversion-pr.yaml => version-preview.yaml} (100%) rename .github/workflows/{bumpversion.yaml => version.yaml} (88%) diff --git a/.github/actions/package-and-upload-artifacts/action.yaml b/.github/actions/package-and-upload-artifacts/action.yaml new file mode 100644 index 00000000..82d4bad4 --- /dev/null +++ b/.github/actions/package-and-upload-artifacts/action.yaml @@ -0,0 +1,45 @@ +name: Package and upload artifacts +description: Package a Python project and upload the artifacts and release notes +runs: + using: 'composite' + steps: + - name: Parse changelog for release notes + shell: bash + run: | + function extract_version_content() { + changelog=$1 + target_version=$2 + + awk -v target="$target_version" ' + /^## / { + if (found) exit; + version=$2; + if (version == target) found=1; + next; + } + found { print; } + ' <<< "$changelog" + } + + changelog=$(cat "CHANGELOG.md") + target_version=${GITHUB_REF#refs/tags/} + echo "TAG_NAME=$target_version" >> $GITHUB_ENV + content=$(extract_version_content "$changelog" "$target_version") + + if [ -n "$content" ]; then + echo "::notice::Found release notes for ${target_version}" + echo "$content" >> release-notes.md + else + echo "::warning::Did not find release notes for ${target_version}" + touch release-notes.md + fi + + - name: Upload release notes + uses: actions/upload-artifact@v3 + with: + name: release-notes + path: release-notes.md + + - name: Package and upload artifacts + if: ${{ env.PACKAGE == 'true' }} + uses: hynek/build-and-inspect-python-package@v1 diff --git a/.github/actions/release/action.yaml b/.github/actions/release/action.yaml new file mode 100644 index 00000000..87b94be1 --- /dev/null +++ b/.github/actions/release/action.yaml @@ -0,0 +1,37 @@ +name: Release +description: Create a GitHub release and upload the package to PyPI +inputs: + pypi-api-token: + description: 'PyPI API token' + required: true + tag-name: + description: 'The name of the tag for the GitHub release' + required: true + +runs: + using: "composite" + steps: + - name: Download packages built by build-and-inspect-python-package + uses: actions/download-artifact@v3 + with: + name: Packages + path: dist + if-no-files-found: warn + + - name: Download release notes + uses: actions/download-artifact@v3 + with: + name: release-notes + if-no-files-found: warn + + - 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 + with: + password: ${{ inputs.pypi-api-token }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index cfea6ac8..00000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,83 +0,0 @@ -name: Release -on: - push: - tags: ["*"] - -jobs: - # Create a GitHub release - release: - name: Create a GitHub release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - name: Checkout the repository - with: - fetch-depth: 0 - token: ${{ secrets.PAT }} - - - name: Setup Python and Git - uses: ./.github/actions/setup-python-and-git - with: - python-version: '3.11' - - - name: Parse changelog - shell: bash - run: | - function extract_version_content() { - changelog=$1 - target_version=$2 - - awk -v target="$target_version" ' - /^## / { - if (found) exit; - version=$2; - if (version == target) found=1; - next; - } - found { print; } - ' <<< "$changelog" - } - - changelog=$(cat "CHANGELOG.md") - target_version=${GITHUB_REF#refs/tags/} - echo "TAG_NAME=$target_version" >> $GITHUB_ENV - content=$(extract_version_content "$changelog" "$target_version") - - if [ -n "$content" ]; then - echo "::notice::Found release notes for ${target_version}" - echo "$content" >> release-notes.md - else - echo "::warning::Did not find release notes for ${target_version}" - touch release-notes.md - fi - - - name: Download packages built by build-and-inspect-python-package - uses: actions/download-artifact@v3 - with: - name: Packages - path: dist - if-no-files-found: warn - - - name: Release - uses: softprops/action-gh-release@v1 - with: - files: dist/* - tag_name: "${{ env.TAG_NAME }}" - body_path: release-notes.md - - # Upload to real PyPI on GitHub Releases. - release-pypi: - name: Publish released package to pypi.org - runs-on: ubuntu-latest - needs: build-package - steps: - - name: Download packages built by build-and-inspect-python-package - uses: actions/download-artifact@v3 - with: - name: Packages - path: dist - - - name: Upload package to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/test.yaml similarity index 100% rename from .github/workflows/ci.yaml rename to .github/workflows/test.yaml diff --git a/.github/workflows/bumpversion-pr.yaml b/.github/workflows/version-preview.yaml similarity index 100% rename from .github/workflows/bumpversion-pr.yaml rename to .github/workflows/version-preview.yaml diff --git a/.github/workflows/bumpversion.yaml b/.github/workflows/version.yaml similarity index 88% rename from .github/workflows/bumpversion.yaml rename to .github/workflows/version.yaml index b605eeec..b56f2231 100644 --- a/.github/workflows/bumpversion.yaml +++ b/.github/workflows/version.yaml @@ -51,6 +51,10 @@ jobs: ;; esac - - name: Package + - name: Package and upload artifacts if: ${{ env.PACKAGE == 'true' }} - uses: hynek/build-and-inspect-python-package@v1 + uses: ./.github/actions/package-and-upload-artifacts + + - name: Create a GitHub release + if: ${{ env.PACKAGE == 'true' }} + uses: ./.github/actions/release From 6ac064eb9b1889981c32782a915cd25b86e4ffe9 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 17 Dec 2023 11:53:13 -0600 Subject: [PATCH 02/12] Put in temporary debugging steps --- .../package-and-upload-artifacts/action.yaml | 6 +++++- .github/workflows/version-preview.yaml | 2 +- .github/workflows/version.yaml | 13 ++++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/actions/package-and-upload-artifacts/action.yaml b/.github/actions/package-and-upload-artifacts/action.yaml index 82d4bad4..830578a5 100644 --- a/.github/actions/package-and-upload-artifacts/action.yaml +++ b/.github/actions/package-and-upload-artifacts/action.yaml @@ -1,5 +1,9 @@ name: Package and upload artifacts description: Package a Python project and upload the artifacts and release notes +inputs: + tag-name: + description: 'The name of the tag for the GitHub release' + required: true runs: using: 'composite' steps: @@ -22,7 +26,7 @@ runs: } changelog=$(cat "CHANGELOG.md") - target_version=${GITHUB_REF#refs/tags/} + target_version=${{ inputs.tag-name }} echo "TAG_NAME=$target_version" >> $GITHUB_ENV content=$(extract_version_content "$changelog" "$target_version") diff --git a/.github/workflows/version-preview.yaml b/.github/workflows/version-preview.yaml index c85ad0c8..02336a94 100644 --- a/.github/workflows/version-preview.yaml +++ b/.github/workflows/version-preview.yaml @@ -5,7 +5,7 @@ on: branches: [master] jobs: - bumpversion: + preview-version-hint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/version.yaml b/.github/workflows/version.yaml index b56f2231..cd68e25e 100644 --- a/.github/workflows/version.yaml +++ b/.github/workflows/version.yaml @@ -42,18 +42,25 @@ jobs: case "$RELEASE_KIND" in major|minor|patch) bump-my-version bump --allow-dirty --verbose "$RELEASE_KIND" - git push - git push --tags + echo "TAG_NAME=$(bump-my-version show current_version)" >> $GITHUB_ENV + # git push + # git push --tags echo "PACKAGE=true" >> $GITHUB_ENV ;; dev) - echo "Intentionally not bumping version for dev release" + echo "Temporary dev release for testing" + bump-my-version bump --allow-dirty --verbose "$RELEASE_KIND" + echo "TAG_NAME=$(bump-my-version show current_version)" >> $GITHUB_ENV + echo "PACKAGE=true" >> $GITHUB_ENV + # echo "Intentionally not bumping version for dev release" ;; esac - name: Package and upload artifacts if: ${{ env.PACKAGE == 'true' }} uses: ./.github/actions/package-and-upload-artifacts + with: + tag-name: ${{ env.TAG_NAME }} - name: Create a GitHub release if: ${{ env.PACKAGE == 'true' }} From 23e6c18cd941e7a8717a8ff62ee9e8aa23a5c242 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 17 Dec 2023 11:56:35 -0600 Subject: [PATCH 03/12] Changed the triggers to cause runs --- .github/workflows/test.yaml | 7 ++++--- .github/workflows/version.yaml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ec8e0cbc..5a5188f9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,9 +1,10 @@ name: CI on: - pull_request: - types: [opened, synchronize] - branches: [master] + workflow_call: +# pull_request: +# types: [opened, synchronize] +# branches: [master] defaults: run: diff --git a/.github/workflows/version.yaml b/.github/workflows/version.yaml index cd68e25e..7ee003cb 100644 --- a/.github/workflows/version.yaml +++ b/.github/workflows/version.yaml @@ -1,7 +1,7 @@ name: Bump the version on merge on: pull_request: - types: [closed] +# types: [closed] branches: [master] jobs: From 12ba54f21e5f1c1853fcd38fca5d23c7350b41a2 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 17 Dec 2023 12:08:29 -0600 Subject: [PATCH 04/12] Fixes committing and download-artifact --- .github/actions/release/action.yaml | 6 ++---- .github/workflows/version.yaml | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/actions/release/action.yaml b/.github/actions/release/action.yaml index 87b94be1..1e16fe97 100644 --- a/.github/actions/release/action.yaml +++ b/.github/actions/release/action.yaml @@ -12,17 +12,15 @@ runs: using: "composite" steps: - name: Download packages built by build-and-inspect-python-package - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: Packages path: dist - if-no-files-found: warn - name: Download release notes - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: release-notes - if-no-files-found: warn - name: Create a GitHub release uses: softprops/action-gh-release@v1 diff --git a/.github/workflows/version.yaml b/.github/workflows/version.yaml index 7ee003cb..14093303 100644 --- a/.github/workflows/version.yaml +++ b/.github/workflows/version.yaml @@ -5,7 +5,7 @@ on: branches: [master] jobs: - version-hint: + version: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -49,7 +49,7 @@ jobs: ;; dev) echo "Temporary dev release for testing" - bump-my-version bump --allow-dirty --verbose "$RELEASE_KIND" + bump-my-version bump --allow-dirty --verbose --no-commit "$RELEASE_KIND" echo "TAG_NAME=$(bump-my-version show current_version)" >> $GITHUB_ENV echo "PACKAGE=true" >> $GITHUB_ENV # echo "Intentionally not bumping version for dev release" From 85a8b4852e55c493f43db8a5e8dd2c2fcaa5fb14 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Mon, 18 Dec 2023 06:44:33 -0600 Subject: [PATCH 05/12] Fixed PR_NUMBER retrieval --- .github/workflows/version.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/version.yaml b/.github/workflows/version.yaml index 14093303..c584649b 100644 --- a/.github/workflows/version.yaml +++ b/.github/workflows/version.yaml @@ -37,8 +37,9 @@ jobs: shell: bash run: | PR_NUMBER=$(gh pr view --json number -q .number || echo "") - REVISION=$(git describe --tags --long | awk -F- '{print $2}') - export PR_NUMBER REVISION + echo "::notice::PR_NUMBER is: ${PR_NUMBER}" + echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV + export PR_NUMBER case "$RELEASE_KIND" in major|minor|patch) bump-my-version bump --allow-dirty --verbose "$RELEASE_KIND" @@ -55,6 +56,8 @@ jobs: # echo "Intentionally not bumping version for dev release" ;; esac + env: + GH_TOKEN: ${{ github.token }} - name: Package and upload artifacts if: ${{ env.PACKAGE == 'true' }} From a53162837561a2cfc673fa4a93a795f087ec0113 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Mon, 18 Dec 2023 06:55:59 -0600 Subject: [PATCH 06/12] downloading all artifacts !minor --- .github/actions/release/action.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions/release/action.yaml b/.github/actions/release/action.yaml index 1e16fe97..6c16bc3b 100644 --- a/.github/actions/release/action.yaml +++ b/.github/actions/release/action.yaml @@ -11,6 +11,11 @@ inputs: runs: using: "composite" steps: + - name: Download packages built by build-and-inspect-python-package + uses: actions/download-artifact@v4 + with: + path: artifacts + - name: Download packages built by build-and-inspect-python-package uses: actions/download-artifact@v4 with: From f90d86fb61b72415dc6a0908157fbba2574f74e4 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Mon, 18 Dec 2023 07:06:33 -0600 Subject: [PATCH 07/12] Showing run id !minor --- .github/actions/package-and-upload-artifacts/action.yaml | 4 ++++ .github/workflows/version.yaml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.github/actions/package-and-upload-artifacts/action.yaml b/.github/actions/package-and-upload-artifacts/action.yaml index 830578a5..5a894f16 100644 --- a/.github/actions/package-and-upload-artifacts/action.yaml +++ b/.github/actions/package-and-upload-artifacts/action.yaml @@ -7,6 +7,10 @@ inputs: runs: using: 'composite' steps: + - name: show runid + shell: bash + run: | + echo "::notice::GitHub Run ID is ${{ github.run_id }}" - name: Parse changelog for release notes shell: bash run: | diff --git a/.github/workflows/version.yaml b/.github/workflows/version.yaml index c584649b..c969b1ef 100644 --- a/.github/workflows/version.yaml +++ b/.github/workflows/version.yaml @@ -58,6 +58,9 @@ jobs: esac env: GH_TOKEN: ${{ github.token }} + - name: show runid + run: | + echo "::notice::GitHub Run ID is ${{ github.run_id }}" - name: Package and upload artifacts if: ${{ env.PACKAGE == 'true' }} From 3f6174297498b641e19ce6a02e48496e6e5c97c8 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Mon, 18 Dec 2023 07:34:03 -0600 Subject: [PATCH 08/12] fixes mismatched artifact up/downloading versions --- .github/actions/package-and-upload-artifacts/action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/package-and-upload-artifacts/action.yaml b/.github/actions/package-and-upload-artifacts/action.yaml index 5a894f16..858b7cba 100644 --- a/.github/actions/package-and-upload-artifacts/action.yaml +++ b/.github/actions/package-and-upload-artifacts/action.yaml @@ -43,11 +43,11 @@ runs: fi - name: Upload release notes - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: release-notes path: release-notes.md - name: Package and upload artifacts if: ${{ env.PACKAGE == 'true' }} - uses: hynek/build-and-inspect-python-package@v1 + uses: hynek/build-and-inspect-python-package@v2 From db3d046faf5ad54f9e585359d1dae4fad0cd1b89 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Mon, 18 Dec 2023 07:47:08 -0600 Subject: [PATCH 09/12] Added id-token write permission to job !minor --- .github/workflows/version.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/version.yaml b/.github/workflows/version.yaml index c969b1ef..de41699f 100644 --- a/.github/workflows/version.yaml +++ b/.github/workflows/version.yaml @@ -6,6 +6,8 @@ on: jobs: version: + permissions: + id-token: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 8aed9595195224ab81d6d9c991a0214266c3088c Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Mon, 18 Dec 2023 07:56:42 -0600 Subject: [PATCH 10/12] fixing permissions and pr stuff !minor --- .github/workflows/version.yaml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/version.yaml b/.github/workflows/version.yaml index de41699f..8804dad9 100644 --- a/.github/workflows/version.yaml +++ b/.github/workflows/version.yaml @@ -8,6 +8,7 @@ jobs: version: permissions: id-token: write + pull-requests: read runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -34,14 +35,24 @@ jobs: echo "release-kind=$RELEASE_KIND" >> $GITHUB_OUTPUT echo "PACKAGE=false" >> $GITHUB_ENV + - name: Get Pull Request Number + id: pr + run: | + PR_NUMBER=$(gh pr view --json number -q .number || echo "") + echo "::set-output name=pull_request_number::${PR_NUMBER}" + echo "::notice::PR_NUMBER is ${PR_NUMBER}" + echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + - name: Bump version if: ${{ env.RELEASE_KIND != 'no-release' }} shell: bash run: | - PR_NUMBER=$(gh pr view --json number -q .number || echo "") - echo "::notice::PR_NUMBER is: ${PR_NUMBER}" - echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV - export PR_NUMBER + # PR_NUMBER=$(gh pr view --json number -q .number || echo "") + # echo "::notice::PR_NUMBER is: ${PR_NUMBER}" + # echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV + # export PR_NUMBER case "$RELEASE_KIND" in major|minor|patch) bump-my-version bump --allow-dirty --verbose "$RELEASE_KIND" From c8f0d45ec40345ebd1c4bd5fbdc70136c51bb31b Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Mon, 18 Dec 2023 08:04:33 -0600 Subject: [PATCH 11/12] Testing the PyPI release !minor --- .github/actions/release/action.yaml | 12 ++++++------ .github/workflows/version.yaml | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/actions/release/action.yaml b/.github/actions/release/action.yaml index 6c16bc3b..eff5d9bf 100644 --- a/.github/actions/release/action.yaml +++ b/.github/actions/release/action.yaml @@ -27,12 +27,12 @@ runs: 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: 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 diff --git a/.github/workflows/version.yaml b/.github/workflows/version.yaml index 8804dad9..f771b04c 100644 --- a/.github/workflows/version.yaml +++ b/.github/workflows/version.yaml @@ -39,9 +39,10 @@ jobs: id: pr run: | PR_NUMBER=$(gh pr view --json number -q .number || echo "") - echo "::set-output name=pull_request_number::${PR_NUMBER}" + echo "pull_request_number=${PR_NUMBER}" >> $GITHUB_OUTPUT echo "::notice::PR_NUMBER is ${PR_NUMBER}" echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV + echo "::notice::event number is ${{ github.event.number }}" env: GITHUB_TOKEN: ${{ secrets.PAT }} From 67ab83d79d67e729bec62a1d25c735ecad41afdb Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Mon, 18 Dec 2023 08:19:55 -0600 Subject: [PATCH 12/12] testing PR acquisition --- .../package-and-upload-artifacts/action.yaml | 4 --- .github/actions/release/action.yaml | 12 ++++---- .github/workflows/version-preview.yaml | 14 +++++++--- .github/workflows/version.yaml | 28 ++++++------------- 4 files changed, 25 insertions(+), 33 deletions(-) diff --git a/.github/actions/package-and-upload-artifacts/action.yaml b/.github/actions/package-and-upload-artifacts/action.yaml index 858b7cba..a06b83ca 100644 --- a/.github/actions/package-and-upload-artifacts/action.yaml +++ b/.github/actions/package-and-upload-artifacts/action.yaml @@ -7,10 +7,6 @@ inputs: runs: using: 'composite' steps: - - name: show runid - shell: bash - run: | - echo "::notice::GitHub Run ID is ${{ github.run_id }}" - name: Parse changelog for release notes shell: bash run: | diff --git a/.github/actions/release/action.yaml b/.github/actions/release/action.yaml index eff5d9bf..6c16bc3b 100644 --- a/.github/actions/release/action.yaml +++ b/.github/actions/release/action.yaml @@ -27,12 +27,12 @@ runs: 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: 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 diff --git a/.github/workflows/version-preview.yaml b/.github/workflows/version-preview.yaml index 02336a94..e65a9abf 100644 --- a/.github/workflows/version-preview.yaml +++ b/.github/workflows/version-preview.yaml @@ -32,14 +32,20 @@ jobs: echo "RELEASE_KIND=$RELEASE_KIND" >> $GITHUB_ENV echo "release-kind=$RELEASE_KIND" >> $GITHUB_OUTPUT + - name: Get Pull Request Number + id: pr + run: | + PR_NUMBER=$(gh pr view --json number -q .number || echo "${{ github.event.number }}") + 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 dry run if: ${{ env.RELEASE_KIND != 'no-release' }} shell: bash run: | - PR_NUMBER=$(gh pr view --json number -q .number || echo "") - REVISION=$(git describe --tags --long | awk -F- '{print $2}') - export PR_NUMBER REVISION - # This will display a full log of what would happen if we were to bump the version. bump-my-version bump --dry-run --verbose "$RELEASE_KIND" diff --git a/.github/workflows/version.yaml b/.github/workflows/version.yaml index f771b04c..6d78ec2c 100644 --- a/.github/workflows/version.yaml +++ b/.github/workflows/version.yaml @@ -38,11 +38,10 @@ jobs: - name: Get Pull Request Number id: pr run: | - PR_NUMBER=$(gh pr view --json number -q .number || echo "") + PR_NUMBER=$(gh pr view --json number -q .number || echo "${{ github.event.number }}") echo "pull_request_number=${PR_NUMBER}" >> $GITHUB_OUTPUT echo "::notice::PR_NUMBER is ${PR_NUMBER}" echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV - echo "::notice::event number is ${{ github.event.number }}" env: GITHUB_TOKEN: ${{ secrets.PAT }} @@ -50,10 +49,6 @@ jobs: if: ${{ env.RELEASE_KIND != 'no-release' }} shell: bash run: | - # PR_NUMBER=$(gh pr view --json number -q .number || echo "") - # echo "::notice::PR_NUMBER is: ${PR_NUMBER}" - # echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV - # export PR_NUMBER case "$RELEASE_KIND" in major|minor|patch) bump-my-version bump --allow-dirty --verbose "$RELEASE_KIND" @@ -70,18 +65,13 @@ jobs: # echo "Intentionally not bumping version for dev release" ;; esac - env: - GH_TOKEN: ${{ github.token }} - - name: show runid - run: | - echo "::notice::GitHub Run ID is ${{ github.run_id }}" - - name: Package and upload artifacts - if: ${{ env.PACKAGE == 'true' }} - uses: ./.github/actions/package-and-upload-artifacts - with: - tag-name: ${{ env.TAG_NAME }} +# - name: Package and upload artifacts +# if: ${{ env.PACKAGE == 'true' }} +# uses: ./.github/actions/package-and-upload-artifacts +# with: +# tag-name: ${{ env.TAG_NAME }} - - name: Create a GitHub release - if: ${{ env.PACKAGE == 'true' }} - uses: ./.github/actions/release +# - name: Create a GitHub release +# if: ${{ env.PACKAGE == 'true' }} +# uses: ./.github/actions/release