From 32f6bd6f3b9428813edbb7a769cb5e28a6ed6da8 Mon Sep 17 00:00:00 2001 From: Luke Lashley Date: Thu, 5 Dec 2024 10:48:10 -0500 Subject: [PATCH 01/11] fix: add testing part and user ghtoken --- .github/workflows/ci.yml | 45 +++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f37d3a9..31c71ce1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,6 @@ jobs: needs: - test concurrency: release - if: github.ref == 'refs/heads/main' permissions: contents: write issues: write @@ -69,27 +68,25 @@ jobs: packages: write environment: name: release - + steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - persist-credentials: false - - name: Python Semantic Release - id: release - uses: python-semantic-release/python-semantic-release@v9.14.0 - with: - github_token: ${{ secrets.DEPLOY_KEY }} - - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@v1.12.2 - - # NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true. - # See https://github.com/actions/runner/issues/1173 - if: steps.release.outputs.released == 'true' - - - name: Publish package distributions to GitHub Releases - uses: python-semantic-release/upload-to-gh-release@v8.7.0 - if: steps.release.outputs.released == 'true' - with: - github_token: ${{ secrets.DEPLOY_KEY }} + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Python Semantic Release + id: release + uses: python-semantic-release/python-semantic-release@v9.14.0 + with: + github_token: ${{ secrets.GH_TOKEN }} + root_options: ${{ github.ref != 'refs/heads/main' && '-vv --noop' || '-vv' }} + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@v1.12.2 + if: github.ref == 'refs/heads/main' && steps.release.outputs.released == 'true' + + - name: Publish package distributions to GitHub Releases + uses: python-semantic-release/upload-to-gh-release@v8.7.0 + if: github.ref == 'refs/heads/main' && steps.release.outputs.released == 'true' + From aab802311ab60e6e6c378337050ed5b97e713467 Mon Sep 17 00:00:00 2001 From: Luke Lashley Date: Thu, 5 Dec 2024 10:55:21 -0500 Subject: [PATCH 02/11] fix: remove testing --- .github/workflows/ci.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31c71ce1..dbaf5289 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,7 @@ jobs: needs: - test concurrency: release + if: github.ref == 'refs/heads/main' permissions: contents: write issues: write @@ -74,19 +75,15 @@ jobs: with: fetch-depth: 0 persist-credentials: false - + - name: Python Semantic Release id: release uses: python-semantic-release/python-semantic-release@v9.14.0 with: github_token: ${{ secrets.GH_TOKEN }} - root_options: ${{ github.ref != 'refs/heads/main' && '-vv --noop' || '-vv' }} - - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@v1.12.2 - if: github.ref == 'refs/heads/main' && steps.release.outputs.released == 'true' - + if: steps.release.outputs.released == 'true' - name: Publish package distributions to GitHub Releases uses: python-semantic-release/upload-to-gh-release@v8.7.0 - if: github.ref == 'refs/heads/main' && steps.release.outputs.released == 'true' - + if: steps.release.outputs.released == 'true' From bf33e280ca20bc54cfd7e9f94b9344702f82264e Mon Sep 17 00:00:00 2001 From: Luke Lashley Date: Thu, 5 Dec 2024 10:58:03 -0500 Subject: [PATCH 03/11] fix: try ghtoken here --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbaf5289..5d17a37f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,7 @@ jobs: needs: - test concurrency: release - if: github.ref == 'refs/heads/main' + # if: github.ref == 'refs/heads/main' permissions: contents: write issues: write @@ -69,13 +69,11 @@ jobs: packages: write environment: name: release - steps: - uses: actions/checkout@v4 with: fetch-depth: 0 persist-credentials: false - - name: Python Semantic Release id: release uses: python-semantic-release/python-semantic-release@v9.14.0 From d0e455a87d6313247744308fbb46ffbc2969a9a7 Mon Sep 17 00:00:00 2001 From: Luke Lashley Date: Thu, 5 Dec 2024 11:04:50 -0500 Subject: [PATCH 04/11] fix: permit other branches --- pyproject.toml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1e909cb0..12b2c0d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,6 @@ codespell = "*" pyshark = "^0.6" [tool.semantic_release] -branch = "main" version_toml = ["pyproject.toml:tool.poetry.version"] build_command = "pip install poetry && poetry build" [tool.semantic_release.commit_parser_options] @@ -59,6 +58,14 @@ allowed_tags = [ "refactor" ] major_tags= ["refactor"] +[semantic_release.branches.main] +match = "release" +prerelease = false + +[tool.semantic_release.branches.other] +match = ".*" +prerelease_token = "rc" +prerelease = true [tool.ruff] ignore = ["F403", "E741"] From 1d1cafd358c5bc5e403009929821f032abb30d45 Mon Sep 17 00:00:00 2001 From: Luke Lashley Date: Thu, 5 Dec 2024 11:41:23 -0500 Subject: [PATCH 05/11] fix: try --- .github/workflows/ci.yml | 47 +++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d17a37f..5fd19048 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,14 +74,41 @@ jobs: with: fetch-depth: 0 persist-credentials: false - - name: Python Semantic Release - id: release - uses: python-semantic-release/python-semantic-release@v9.14.0 + - name: Set up GitHub CLI + uses: actions/setup-gh@v2 with: - github_token: ${{ secrets.GH_TOKEN }} - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@v1.12.2 - if: steps.release.outputs.released == 'true' - - name: Publish package distributions to GitHub Releases - uses: python-semantic-release/upload-to-gh-release@v8.7.0 - if: steps.release.outputs.released == 'true' + token: ${{ secrets.GH_TOKEN }} + + - name: Configure Git + run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + + # - name: Python Semantic Release + # id: release + # uses: python-semantic-release/python-semantic-release@v9.14.0 + # with: + # github_token: ${{ secrets.GH_TOKEN }} + # push: false + # commit_author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" + + - name: Create Release Branch and MR + # if: steps.release.outputs.released == 'true' + run: | + # Create a release branch + RELEASE_BRANCH="release/${{ steps.release.outputs.version }}" + git checkout -b "$RELEASE_BRANCH" + git push origin "$RELEASE_BRANCH" + + # Create a merge request using GitHub CLI + gh pr create \ + --base main \ + --head "$RELEASE_BRANCH" \ + --title "Release ${{ steps.release.outputs.version }}" \ + --body "This MR contains the latest release changes for version ${{ steps.release.outputs.version }}." + # - name: Publish package distributions to PyPI + # uses: pypa/gh-action-pypi-publish@v1.12.2 + # if: steps.release.outputs.released == 'true' + # - name: Publish package distributions to GitHub Releases + # uses: python-semantic-release/upload-to-gh-release@v8.7.0 + # if: steps.release.outputs.released == 'true' From 51b8903b778a1e7df38c8686e9bad1fa749b201f Mon Sep 17 00:00:00 2001 From: Luke Lashley Date: Thu, 5 Dec 2024 11:47:06 -0500 Subject: [PATCH 06/11] fix: try agin --- .github/workflows/ci.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5fd19048..e126cfd5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,20 +92,34 @@ jobs: # push: false # commit_author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" - - name: Create Release Branch and MR - # if: steps.release.outputs.released == 'true' + - name: Install GitHub CLI run: | - # Create a release branch - RELEASE_BRANCH="release/${{ steps.release.outputs.version }}" + sudo apt update + sudo apt install -y gh + + - name: Authenticate GitHub CLI + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + echo "${{ secrets.GH_TOKEN }}" | gh auth login --with-token + + - name: Prepare Release with Semantic Release + id: release + run: | + RELEASE_BRANCH="release/$(python-semantic-release version --noop)" git checkout -b "$RELEASE_BRANCH" + python-semantic-release changelog + git add . + git commit -m "chore(release): prepare release $(python-semantic-release version --noop)" git push origin "$RELEASE_BRANCH" - # Create a merge request using GitHub CLI + - name: Create Merge Request + run: | gh pr create \ --base main \ --head "$RELEASE_BRANCH" \ - --title "Release ${{ steps.release.outputs.version }}" \ - --body "This MR contains the latest release changes for version ${{ steps.release.outputs.version }}." + --title "Release $(python-semantic-release version --noop)" \ + --body "This PR contains the release changes for version $(python-semantic-release version --noop)." # - name: Publish package distributions to PyPI # uses: pypa/gh-action-pypi-publish@v1.12.2 # if: steps.release.outputs.released == 'true' From d7a0a6894e4e26482922360aa3970675788ee68a Mon Sep 17 00:00:00 2001 From: Luke Lashley Date: Thu, 5 Dec 2024 12:18:00 -0500 Subject: [PATCH 07/11] fix: remove actions/setup-gh@v2 --- .github/workflows/ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e126cfd5..d57e47da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,11 +74,6 @@ jobs: with: fetch-depth: 0 persist-credentials: false - - name: Set up GitHub CLI - uses: actions/setup-gh@v2 - with: - token: ${{ secrets.GH_TOKEN }} - - name: Configure Git run: | git config user.name "${{ github.actor }}" From 7f1a0e15c4ce933df38d741dce0e949d445beac7 Mon Sep 17 00:00:00 2001 From: Luke Lashley Date: Thu, 5 Dec 2024 12:24:35 -0500 Subject: [PATCH 08/11] fix: modify --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d57e47da..354b384f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,7 +96,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} run: | - echo "${{ secrets.GH_TOKEN }}" | gh auth login --with-token + gh auth status + + + - name: Prepare Release with Semantic Release id: release From f1be6ebfd49be886d7ee98715defe67e3890cd3d Mon Sep 17 00:00:00 2001 From: Luke Lashley Date: Thu, 5 Dec 2024 12:30:58 -0500 Subject: [PATCH 09/11] fix: use action --- .github/workflows/ci.yml | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 354b384f..28cf3f93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,45 +78,26 @@ jobs: run: | git config user.name "${{ github.actor }}" git config user.email "${{ github.actor }}@users.noreply.github.com" - - # - name: Python Semantic Release - # id: release - # uses: python-semantic-release/python-semantic-release@v9.14.0 - # with: - # github_token: ${{ secrets.GH_TOKEN }} - # push: false - # commit_author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" - + - name: Python Semantic Release + uses: python-semantic-release/python-semantic-release@v9.14.0 + with: + github_token: ${{ secrets.GH_TOKEN }} + push: false - name: Install GitHub CLI run: | sudo apt update sudo apt install -y gh - - name: Authenticate GitHub CLI env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} run: | gh auth status - - - - - - name: Prepare Release with Semantic Release - id: release - run: | - RELEASE_BRANCH="release/$(python-semantic-release version --noop)" - git checkout -b "$RELEASE_BRANCH" - python-semantic-release changelog - git add . - git commit -m "chore(release): prepare release $(python-semantic-release version --noop)" - git push origin "$RELEASE_BRANCH" - - name: Create Merge Request run: | gh pr create \ --base main \ --head "$RELEASE_BRANCH" \ - --title "Release $(python-semantic-release version --noop)" \ + --title "Release $(python-semantic-release version)" \ --body "This PR contains the release changes for version $(python-semantic-release version --noop)." # - name: Publish package distributions to PyPI # uses: pypa/gh-action-pypi-publish@v1.12.2 From 73bbd211bdaa2c40311d43b290974bd18b92a8cd Mon Sep 17 00:00:00 2001 From: Luke Lashley Date: Thu, 5 Dec 2024 12:39:37 -0500 Subject: [PATCH 10/11] fix: change branch --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28cf3f93..d95d1263 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,6 +74,8 @@ jobs: with: fetch-depth: 0 persist-credentials: false + - name: Check out the target branch + run: git checkout Lash-L-patch-19 - name: Configure Git run: | git config user.name "${{ github.actor }}" From 396e61706204d79c4649df137250f754fefbf824 Mon Sep 17 00:00:00 2001 From: Luke Lashley Date: Thu, 5 Dec 2024 12:44:16 -0500 Subject: [PATCH 11/11] feat: add token --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d95d1263..0702c79a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,6 +95,8 @@ jobs: run: | gh auth status - name: Create Merge Request + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | gh pr create \ --base main \