From c991cf7c394f728440cb9408ee98904461411725 Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 07:56:46 +0900 Subject: [PATCH 01/27] ci: add action - create PR of updating version --- .../workflows/create-pr-version-update.yml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/create-pr-version-update.yml diff --git a/.github/workflows/create-pr-version-update.yml b/.github/workflows/create-pr-version-update.yml new file mode 100644 index 0000000..78ba1ca --- /dev/null +++ b/.github/workflows/create-pr-version-update.yml @@ -0,0 +1,62 @@ +name: Create PR (update version) + +on: + push: +# workflow_dispatch: +# inputs: +# segment: +# description: increment version method +# type: string +# required: true +# options: +# - major # 1.0.0 to 2.0.0 +# - minor # 1.0.0 to 1.1.0 +# - micro # 1.0.0 to 1.0.1 + +env: + branch-name: "version-update" + +jobs: + commit-and-push: + name: Commit and push + runs-on: ubuntu-latest + outputs: + new-version: ${{ steps.new-version.outputs.version }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Hatch + uses: pypa/hatch@install + + - name: Configure git + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + + - name: Create branch + run: git checkout -b ${{ env.branch-name }} origin/main + + - name: Update version + run: hatch version micro + + - name: Get new version number + id: new-version + run: echo "version=$(hatch version)" >> $GITHUB_OUTPUT + + - name: Commit and push + run: | + git commit -am "build: update version to ${{ steps.new-version.outputs.version }}" + git push --set-upstream origin ${{ env.branch-name }} + + create-pr: + runs-on: ubuntu-latest + needs: + - commit-and-push + steps: + - name: Create PR + run: | + gh pr create \ + --base main --head ${{ env.branch-name }} \ + --title "Update version to ${{ needs.commit-and-push.outputs.new-version }}" \ + --label "update version" From 0af21c8711190fc69f8eab6548ca02f3a73c81fb Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 08:20:01 +0900 Subject: [PATCH 02/27] ci: add action - create new release --- .github/workflows/create-new-release.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/create-new-release.yml diff --git a/.github/workflows/create-new-release.yml b/.github/workflows/create-new-release.yml new file mode 100644 index 0000000..a929706 --- /dev/null +++ b/.github/workflows/create-new-release.yml @@ -0,0 +1,20 @@ +name: Create new release + +on: + push: + tags: + - "v*" + +jobs: + main: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Create a release + uses: elgohr/Github-Release-Action@v5 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + title: ${{ github.ref }} From ca33a86b4fc838d71c5c57b6734fcb35de113faf Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 08:48:22 +0900 Subject: [PATCH 03/27] ci: create-new-release.yml - tag and create release at the same workflow --- .github/workflows/create-new-release.yml | 39 +++++++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-new-release.yml b/.github/workflows/create-new-release.yml index a929706..c1fae73 100644 --- a/.github/workflows/create-new-release.yml +++ b/.github/workflows/create-new-release.yml @@ -1,13 +1,41 @@ name: Create new release on: - push: - tags: - - "v*" + pull_request: + branches: + - main + types: + - closed jobs: - main: + push-tag: + if: ${{ contains(github.event.pull_request.labels.*.name, 'version update') && github.event.pull_request.merged }} runs-on: ubuntu-latest + outputs: + tag: ${{ steps.tag.outputs.value }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Hatch + uses: pypa/hatch@install + + - name: Configure git + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + + - name: Push a tag + id: tag + run: | + tag="v$(hatch version)" + git tag -a ${tag} -m "New release ${tag} (tagged by github-actions[bot])" + git push origin ${tag} + echo "value=${tag}" >> $GITHUB_OUTPUT + + create-release: + runs-on: ubuntu-latest + needs: push-tag steps: - name: Checkout repository uses: actions/checkout@v4 @@ -17,4 +45,5 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - title: ${{ github.ref }} + title: ${{ steps.tag.outputs.value }} + tag: ${{ steps.tag.outputs.value }} From 74b731e4882439994dff7aa32b26019e78701c38 Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 08:54:22 +0900 Subject: [PATCH 04/27] ci: create-pr-version-update.yml - fix create branch --- .github/workflows/create-pr-version-update.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-pr-version-update.yml b/.github/workflows/create-pr-version-update.yml index 78ba1ca..cbfc230 100644 --- a/.github/workflows/create-pr-version-update.yml +++ b/.github/workflows/create-pr-version-update.yml @@ -25,6 +25,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: main - name: Install Hatch uses: pypa/hatch@install @@ -35,7 +37,7 @@ jobs: git config user.email 'github-actions[bot]@users.noreply.github.com' - name: Create branch - run: git checkout -b ${{ env.branch-name }} origin/main + run: git checkout -b ${{ env.branch-name }} main - name: Update version run: hatch version micro From 0ab32f2f03f710d84903a9f7287d2f6a6c61fb00 Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 09:00:23 +0900 Subject: [PATCH 05/27] ci: create-pr-version-update.yml - permission of contents to write --- .github/workflows/create-pr-version-update.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/create-pr-version-update.yml b/.github/workflows/create-pr-version-update.yml index cbfc230..a4cd905 100644 --- a/.github/workflows/create-pr-version-update.yml +++ b/.github/workflows/create-pr-version-update.yml @@ -20,6 +20,8 @@ jobs: commit-and-push: name: Commit and push runs-on: ubuntu-latest + permissions: + contents: write outputs: new-version: ${{ steps.new-version.outputs.version }} steps: From 48af68b26e3f3774415b7ec7d89b2f145965289f Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 09:03:57 +0900 Subject: [PATCH 06/27] ci: create-pr-version-update.yml - fix job create-pr --- .github/workflows/create-pr-version-update.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/create-pr-version-update.yml b/.github/workflows/create-pr-version-update.yml index a4cd905..1acd0d4 100644 --- a/.github/workflows/create-pr-version-update.yml +++ b/.github/workflows/create-pr-version-update.yml @@ -54,7 +54,10 @@ jobs: git push --set-upstream origin ${{ env.branch-name }} create-pr: + name: Create a PR runs-on: ubuntu-latest + permissions: + pull-requests: write needs: - commit-and-push steps: @@ -64,3 +67,5 @@ jobs: --base main --head ${{ env.branch-name }} \ --title "Update version to ${{ needs.commit-and-push.outputs.new-version }}" \ --label "update version" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b0031145b512d134057209a1cbbd0d7e1d626f97 Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 09:09:49 +0900 Subject: [PATCH 07/27] ci: create-pr-version-update.yml - delete remote branch "version-update" if exists --- .github/workflows/create-pr-version-update.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-pr-version-update.yml b/.github/workflows/create-pr-version-update.yml index 1acd0d4..2161ae3 100644 --- a/.github/workflows/create-pr-version-update.yml +++ b/.github/workflows/create-pr-version-update.yml @@ -38,8 +38,10 @@ jobs: git config user.name 'github-actions[bot]' git config user.email 'github-actions[bot]@users.noreply.github.com' - - name: Create branch - run: git checkout -b ${{ env.branch-name }} main + - name: Create branch (after clean) + run: | + git push -d origin ${{ env.branch-name }} || true + git checkout -b ${{ env.branch-name }} main - name: Update version run: hatch version micro From 1275ccce0eeb5da2ec69aa297f6f1728ef5bf95f Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 09:11:46 +0900 Subject: [PATCH 08/27] ci: create-pr-version-update.yml - add missing body to PR --- .github/workflows/create-pr-version-update.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/create-pr-version-update.yml b/.github/workflows/create-pr-version-update.yml index 2161ae3..2bb9954 100644 --- a/.github/workflows/create-pr-version-update.yml +++ b/.github/workflows/create-pr-version-update.yml @@ -68,6 +68,7 @@ jobs: gh pr create \ --base main --head ${{ env.branch-name }} \ --title "Update version to ${{ needs.commit-and-push.outputs.new-version }}" \ + --body "New release is created after you merge the PR." \ --label "update version" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 436cb0d5008135e74d0d9a95093e0c80f9a1786f Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 09:12:40 +0900 Subject: [PATCH 09/27] ci: create-pr-version-update.yml - add missing checkout --- .github/workflows/create-pr-version-update.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/create-pr-version-update.yml b/.github/workflows/create-pr-version-update.yml index 2bb9954..511b913 100644 --- a/.github/workflows/create-pr-version-update.yml +++ b/.github/workflows/create-pr-version-update.yml @@ -63,6 +63,9 @@ jobs: needs: - commit-and-push steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Create PR run: | gh pr create \ From dad88a216ccb38c7a6d8c5b268732cd809b33346 Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 09:16:04 +0900 Subject: [PATCH 10/27] ci: create-pr-version-update.yml - change PR label name --- ...create-pr-version-update.yml => create-pr-new-release.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{create-pr-version-update.yml => create-pr-new-release.yml} (96%) diff --git a/.github/workflows/create-pr-version-update.yml b/.github/workflows/create-pr-new-release.yml similarity index 96% rename from .github/workflows/create-pr-version-update.yml rename to .github/workflows/create-pr-new-release.yml index 511b913..a124f57 100644 --- a/.github/workflows/create-pr-version-update.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -1,4 +1,4 @@ -name: Create PR (update version) +name: Create PR (for new release) on: push: @@ -72,6 +72,6 @@ jobs: --base main --head ${{ env.branch-name }} \ --title "Update version to ${{ needs.commit-and-push.outputs.new-version }}" \ --body "New release is created after you merge the PR." \ - --label "update version" + --label "new release" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From bb4eebde39b77a27c0771bc0514dd8426892907b Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 09:29:14 +0900 Subject: [PATCH 11/27] ci: create-pr-version-update.yml - manually trigger test workflow --- .github/workflows/create-new-release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/create-new-release.yml b/.github/workflows/create-new-release.yml index c1fae73..2f1f68a 100644 --- a/.github/workflows/create-new-release.yml +++ b/.github/workflows/create-new-release.yml @@ -47,3 +47,6 @@ jobs: with: title: ${{ steps.tag.outputs.value }} tag: ${{ steps.tag.outputs.value }} + + - name: Manually trigger the workflow "test" + run: gh workflow run test.yml From c6c0f2415b48bb7407a83c25696ae3257be3490d Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 09:30:42 +0900 Subject: [PATCH 12/27] ci: fix pasting --- .github/workflows/create-new-release.yml | 3 --- .github/workflows/create-pr-new-release.yml | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-new-release.yml b/.github/workflows/create-new-release.yml index 2f1f68a..c1fae73 100644 --- a/.github/workflows/create-new-release.yml +++ b/.github/workflows/create-new-release.yml @@ -47,6 +47,3 @@ jobs: with: title: ${{ steps.tag.outputs.value }} tag: ${{ steps.tag.outputs.value }} - - - name: Manually trigger the workflow "test" - run: gh workflow run test.yml diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index a124f57..1efb160 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -75,3 +75,6 @@ jobs: --label "new release" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Manually trigger the workflow "test" + run: gh workflow run test.yml From a13ebf85d9ebb82eaebb98a700bca1e298e981b8 Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 09:33:35 +0900 Subject: [PATCH 13/27] ci: create-pr-new-release.yml - close existing PR before create --- .github/workflows/create-pr-new-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index 1efb160..9e2cca2 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -66,8 +66,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Create PR + - name: Create PR (after clean) run: | + gh pr close ${{ env.branch-name }} --comment "This PR is deprecated." || true gh pr create \ --base main --head ${{ env.branch-name }} \ --title "Update version to ${{ needs.commit-and-push.outputs.new-version }}" \ From 41e961dca6e717589cde5dddfdc274b944e7675b Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 09:34:50 +0900 Subject: [PATCH 14/27] ci: create-pr-new-release.yml - add missing env when triggering a workflow --- .github/workflows/create-pr-new-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index 9e2cca2..7ae6614 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -79,3 +79,5 @@ jobs: - name: Manually trigger the workflow "test" run: gh workflow run test.yml + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 86687526627051b7e6d4b39c2fdf6311bd655d92 Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 09:37:37 +0900 Subject: [PATCH 15/27] ci: create-pr-new-release.yml - add an actions-write permission --- .github/workflows/create-pr-new-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index 7ae6614..52633fc 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -60,6 +60,7 @@ jobs: runs-on: ubuntu-latest permissions: pull-requests: write + actions: write needs: - commit-and-push steps: From 4b21e2cd9c2d4210aadc7c74798a64d75d1b523c Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 09:39:31 +0900 Subject: [PATCH 16/27] ci: test.yml - add workflow_dispatch trigger --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed59835..e5569ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,7 @@ on: branches: - main workflow_call: + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} From abec3a30bc73926cc7973293f6acdbc73c41d561 Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 09:40:34 +0900 Subject: [PATCH 17/27] ci: create-pr-new-release.yml - specify branch name when trigger test --- .github/workflows/create-pr-new-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index 52633fc..2b74122 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -79,6 +79,6 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Manually trigger the workflow "test" - run: gh workflow run test.yml + run: gh workflow run test.yml --ref ${{ env.branch-name }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 9382cb6eff13996baa22ccbbe1692ac83a0b806b Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 10:28:16 +0900 Subject: [PATCH 18/27] ci: create-pr-new-release.yml - create token via GitHub Apps --- .github/workflows/create-pr-new-release.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index 2b74122..7793fc6 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -67,6 +67,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - uses: actions/create-github-app-token@v1 + id: generate-token + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + - name: Create PR (after clean) run: | gh pr close ${{ env.branch-name }} --comment "This PR is deprecated." || true @@ -76,9 +82,9 @@ jobs: --body "New release is created after you merge the PR." \ --label "new release" env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ steps.generate-token.outputs.token }} - - name: Manually trigger the workflow "test" - run: gh workflow run test.yml --ref ${{ env.branch-name }} - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# - name: Manually trigger the workflow "test" +# run: gh workflow run test.yml --ref ${{ env.branch-name }} +# env: +# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 9f3c6be234ea30f65e2ee5bc4959f1eb9b31fd64 Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 10:29:51 +0900 Subject: [PATCH 19/27] ci: create-pr-new-release.yml - fix secret keys --- .github/workflows/create-pr-new-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index 7793fc6..b64c9b2 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -70,8 +70,8 @@ jobs: - uses: actions/create-github-app-token@v1 id: generate-token with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} + app-id: ${{ secrets.REPOSITORY_APP_ID }} + private-key: ${{ secrets.REPOSITORY_APP_PRIVATE_KEY }} - name: Create PR (after clean) run: | From f878bdf810298c1f6ec06a760ec88d7516083aec Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 10:40:13 +0900 Subject: [PATCH 20/27] ci: create-pr-new-release.yml - remove step "manually run workflow" --- .github/workflows/create-pr-new-release.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index b64c9b2..cedc930 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -60,7 +60,6 @@ jobs: runs-on: ubuntu-latest permissions: pull-requests: write - actions: write needs: - commit-and-push steps: @@ -83,8 +82,3 @@ jobs: --label "new release" env: GH_TOKEN: ${{ steps.generate-token.outputs.token }} - -# - name: Manually trigger the workflow "test" -# run: gh workflow run test.yml --ref ${{ env.branch-name }} -# env: -# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 66727cd5922d7c1b9e792ce26c648cf44c2efb3f Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 10:44:51 +0900 Subject: [PATCH 21/27] ci: create-pr-new-release.yml - add reviewers to PR --- .github/workflows/create-pr-new-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index cedc930..8336d9a 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -15,6 +15,7 @@ on: env: branch-name: "version-update" + reviewers: "noritakaIzumi" jobs: commit-and-push: @@ -79,6 +80,7 @@ jobs: --base main --head ${{ env.branch-name }} \ --title "Update version to ${{ needs.commit-and-push.outputs.new-version }}" \ --body "New release is created after you merge the PR." \ + --reviewer ${{ env.reviewers }} --label "new release" env: GH_TOKEN: ${{ steps.generate-token.outputs.token }} From fd13fc45a0e5ef12d0e8d2017dc9b8071bd0bcbc Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 10:47:08 +0900 Subject: [PATCH 22/27] ci: create-pr-new-release.yml - introduce variable "base-branch" --- .github/workflows/create-pr-new-release.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index 8336d9a..9caaad7 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -15,6 +15,7 @@ on: env: branch-name: "version-update" + base-branch: "main" reviewers: "noritakaIzumi" jobs: @@ -29,7 +30,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 with: - ref: main + ref: ${{ env.base-branch }} - name: Install Hatch uses: pypa/hatch@install @@ -42,7 +43,7 @@ jobs: - name: Create branch (after clean) run: | git push -d origin ${{ env.branch-name }} || true - git checkout -b ${{ env.branch-name }} main + git checkout -b ${{ env.branch-name }} ${{ env.base-branch }} - name: Update version run: hatch version micro @@ -77,7 +78,8 @@ jobs: run: | gh pr close ${{ env.branch-name }} --comment "This PR is deprecated." || true gh pr create \ - --base main --head ${{ env.branch-name }} \ + --base ${{ env.base-branch }} \ + --head ${{ env.branch-name }} \ --title "Update version to ${{ needs.commit-and-push.outputs.new-version }}" \ --body "New release is created after you merge the PR." \ --reviewer ${{ env.reviewers }} From 59c7ef74d409e41d41f8e57dfdc5e97f69de9b3d Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 10:51:31 +0900 Subject: [PATCH 23/27] ci: create-pr-new-release.yml - set assignee to PR --- .github/workflows/create-pr-new-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index 9caaad7..de5ab47 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -82,7 +82,8 @@ jobs: --head ${{ env.branch-name }} \ --title "Update version to ${{ needs.commit-and-push.outputs.new-version }}" \ --body "New release is created after you merge the PR." \ - --reviewer ${{ env.reviewers }} + --reviewer ${{ env.reviewers }} \ + --assignee ${{ github.event.pull_request.user.login }} --label "new release" env: GH_TOKEN: ${{ steps.generate-token.outputs.token }} From bfc68e6aaa85813f9a8fbdfc37bea739e6269dcf Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 10:56:35 +0900 Subject: [PATCH 24/27] ci: create-pr-new-release.yml - fix assignee --- .github/workflows/create-pr-new-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index de5ab47..d54b346 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -83,7 +83,7 @@ jobs: --title "Update version to ${{ needs.commit-and-push.outputs.new-version }}" \ --body "New release is created after you merge the PR." \ --reviewer ${{ env.reviewers }} \ - --assignee ${{ github.event.pull_request.user.login }} + --assignee ${{ github.actor }} --label "new release" env: GH_TOKEN: ${{ steps.generate-token.outputs.token }} From 9351110dbdb267491838ab245a32eb3a8aba6a8d Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 10:58:02 +0900 Subject: [PATCH 25/27] ci: create-pr-new-release.yml - fix command --- .github/workflows/create-pr-new-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index d54b346..db8cdec 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -83,7 +83,7 @@ jobs: --title "Update version to ${{ needs.commit-and-push.outputs.new-version }}" \ --body "New release is created after you merge the PR." \ --reviewer ${{ env.reviewers }} \ - --assignee ${{ github.actor }} + --assignee ${{ github.actor }} \ --label "new release" env: GH_TOKEN: ${{ steps.generate-token.outputs.token }} From f6b290321025387daf3dd556f92c549d256bce39 Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 11:05:45 +0900 Subject: [PATCH 26/27] ci: create-pr-new-release.yml - temporarily update version with dev segment --- .github/workflows/create-pr-new-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index db8cdec..2dc54b7 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -12,6 +12,7 @@ on: # - major # 1.0.0 to 2.0.0 # - minor # 1.0.0 to 1.1.0 # - micro # 1.0.0 to 1.0.1 +# - dev # 1.0.0 to 1.0.0dev0 env: branch-name: "version-update" @@ -46,7 +47,7 @@ jobs: git checkout -b ${{ env.branch-name }} ${{ env.base-branch }} - name: Update version - run: hatch version micro + run: hatch version dev - name: Get new version number id: new-version From 5200526af966b8d60c9b49c894f10004ff67d002 Mon Sep 17 00:00:00 2001 From: Noritaka IZUMI Date: Mon, 4 Nov 2024 11:19:50 +0900 Subject: [PATCH 27/27] ci: create-pr-new-release.yml - change trigger to workflow_dispatch --- .github/workflows/create-pr-new-release.yml | 25 ++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/create-pr-new-release.yml b/.github/workflows/create-pr-new-release.yml index 2dc54b7..8e145a3 100644 --- a/.github/workflows/create-pr-new-release.yml +++ b/.github/workflows/create-pr-new-release.yml @@ -1,18 +1,17 @@ name: Create PR (for new release) on: - push: -# workflow_dispatch: -# inputs: -# segment: -# description: increment version method -# type: string -# required: true -# options: -# - major # 1.0.0 to 2.0.0 -# - minor # 1.0.0 to 1.1.0 -# - micro # 1.0.0 to 1.0.1 -# - dev # 1.0.0 to 1.0.0dev0 + workflow_dispatch: + inputs: + segment: + description: increment version method + type: string + required: true + options: + - major # 1.0.0 to 2.0.0 + - minor # 1.0.0 to 1.1.0 + - micro # 1.0.0 to 1.0.1 + - dev # 1.0.0 to 1.0.0dev0 env: branch-name: "version-update" @@ -47,7 +46,7 @@ jobs: git checkout -b ${{ env.branch-name }} ${{ env.base-branch }} - name: Update version - run: hatch version dev + run: hatch version ${{ inputs.segment }} - name: Get new version number id: new-version