From 720923cc60d9efbf43fd185559a138dca8ea3365 Mon Sep 17 00:00:00 2001 From: b-yap <2826165+b-yap@users.noreply.github.com> Date: Thu, 4 Jul 2024 13:59:16 +0800 Subject: [PATCH 1/9] manual node version-up --- .github/workflows/node-version-up.yml | 55 +++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/node-version-up.yml diff --git a/.github/workflows/node-version-up.yml b/.github/workflows/node-version-up.yml new file mode 100644 index 000000000..f1d6d781d --- /dev/null +++ b/.github/workflows/node-version-up.yml @@ -0,0 +1,55 @@ +name: Node Version Up + +on: + workflow_dispatch: + inputs: + versioning: + description: "node version up: major, minor, or patch" + required: true + default: "patch" + +jobs: + bump-version: + runs-on: ubuntu-latest + name: bump version + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup user + run: | + git config user.name github-actions + git config user.email github-actions@github.com + - name: install cargo-edit + run: | + cargo install cargo-edit + - name: set new version ${{ github.event.inputs.versioning }} + continue-on-error: false + run: | + cargo set-version --bump ${{ github.event.inputs.versioning }} --package pendulum-node + - name: save updated version + id: new-version + run: | + cd node + echo "version=$(cargo metadata --format-version=1 --no-deps | jq '.packages[0].version')" >> "$GITHUB_OUTPUT" + cd .. + - name: save branch name + id: branch-name + run: | + echo "branch_name=release/upgrade-node-to-${{ steps.new-version.outputs.version }}" >> "$GITHUB_OUTPUT" + - name: checkout to new version + run: | + git checkout -b ${{ steps.branch-name.outputs.branch_name }} + git add node/Cargo.toml + git commit -m "upgrade node to ${{ steps.new-version.outputs.version }}" + git push --set-upstream origin ${{ steps.branch-name.outputs.branch_name }} +# - name: Create Pull Request +# uses: peter-evans/create-pull-request@v6.1.0 +# with: +# base: "main" +# title: "release: upgrade node to ${{ steps.new-version.outputs.version }}" +# branch: "${{ steps.branch-name.outputs.branch_name }}" +# body: "View [CHANGES](https://github.com/${{ github.repository }}/compare/main...release/upgrade-node-to-${{ steps.new-version.outputs.version}})" +# token: ${{ secrets.GITHUB_TOKEN }} + From 3d6f62a997fc55583266f3e3ffad462e03bffca6 Mon Sep 17 00:00:00 2001 From: b-yap <2826165+b-yap@users.noreply.github.com> Date: Thu, 4 Jul 2024 14:01:55 +0800 Subject: [PATCH 2/9] test on PR first --- .github/workflows/node-version-up.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/node-version-up.yml b/.github/workflows/node-version-up.yml index f1d6d781d..44f0d4a96 100644 --- a/.github/workflows/node-version-up.yml +++ b/.github/workflows/node-version-up.yml @@ -7,6 +7,12 @@ on: description: "node version up: major, minor, or patch" required: true default: "patch" + pull_request: + branches: + - main + push: + branches: + - main jobs: bump-version: From 34c34722540f95cb798f1e97eb03e68df5f26bb2 Mon Sep 17 00:00:00 2001 From: b-yap <2826165+b-yap@users.noreply.github.com> Date: Thu, 4 Jul 2024 14:07:40 +0800 Subject: [PATCH 3/9] test on PR first --- .github/workflows/node-version-up.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/node-version-up.yml b/.github/workflows/node-version-up.yml index 44f0d4a96..abafed234 100644 --- a/.github/workflows/node-version-up.yml +++ b/.github/workflows/node-version-up.yml @@ -30,10 +30,12 @@ jobs: - name: install cargo-edit run: | cargo install cargo-edit - - name: set new version ${{ github.event.inputs.versioning }} +# - name: set new version ${{ github.event.inputs.versioning }} + - name: set new version continue-on-error: false run: | - cargo set-version --bump ${{ github.event.inputs.versioning }} --package pendulum-node + cargo set-version --bump patch --package pendulum-node +# cargo set-version --bump ${{ github.event.inputs.versioning }} --package pendulum-node - name: save updated version id: new-version run: | From 2cc3608358b86334d081e058d0c82dd32392e96e Mon Sep 17 00:00:00 2001 From: b-yap <2826165+b-yap@users.noreply.github.com> Date: Thu, 4 Jul 2024 15:11:39 +0800 Subject: [PATCH 4/9] test signing of commit --- .github/workflows/node-version-up.yml | 32 ++++++++++++++++----------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/node-version-up.yml b/.github/workflows/node-version-up.yml index abafed234..bf44b2bdf 100644 --- a/.github/workflows/node-version-up.yml +++ b/.github/workflows/node-version-up.yml @@ -46,18 +46,24 @@ jobs: id: branch-name run: | echo "branch_name=release/upgrade-node-to-${{ steps.new-version.outputs.version }}" >> "$GITHUB_OUTPUT" - - name: checkout to new version + git checkout -b release/upgrade-node-to-${{ steps.new-version.outputs.version }} + - name: commit new version up + uses: swinton/commit@v2.x + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + files: + node/Cargo.toml + commit-message: "upgrade node to ${{ steps.new-version.outputs.version }}" + id: commit + - name: push commit run: | - git checkout -b ${{ steps.branch-name.outputs.branch_name }} - git add node/Cargo.toml - git commit -m "upgrade node to ${{ steps.new-version.outputs.version }}" git push --set-upstream origin ${{ steps.branch-name.outputs.branch_name }} -# - name: Create Pull Request -# uses: peter-evans/create-pull-request@v6.1.0 -# with: -# base: "main" -# title: "release: upgrade node to ${{ steps.new-version.outputs.version }}" -# branch: "${{ steps.branch-name.outputs.branch_name }}" -# body: "View [CHANGES](https://github.com/${{ github.repository }}/compare/main...release/upgrade-node-to-${{ steps.new-version.outputs.version}})" -# token: ${{ secrets.GITHUB_TOKEN }} - + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6.1.0 + with: + base: "main" + title: "release: upgrade node to ${{ steps.new-version.outputs.version }}" + branch: "${{ steps.branch-name.outputs.branch_name }}" + body: "View [CHANGES](https://github.com/${{ github.repository }}/compare/main...release/upgrade-node-to-${{ steps.new-version.outputs.version}})" + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 313320d544ea27ecbab9adb21945c25918f12f55 Mon Sep 17 00:00:00 2001 From: b-yap <2826165+b-yap@users.noreply.github.com> Date: Thu, 4 Jul 2024 15:28:46 +0800 Subject: [PATCH 5/9] use chromeq/commit@v2.x --- .github/workflows/node-version-up.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/node-version-up.yml b/.github/workflows/node-version-up.yml index bf44b2bdf..8eff555e5 100644 --- a/.github/workflows/node-version-up.yml +++ b/.github/workflows/node-version-up.yml @@ -48,14 +48,13 @@ jobs: echo "branch_name=release/upgrade-node-to-${{ steps.new-version.outputs.version }}" >> "$GITHUB_OUTPUT" git checkout -b release/upgrade-node-to-${{ steps.new-version.outputs.version }} - name: commit new version up - uses: swinton/commit@v2.x + uses: chromeq/commit@v2.x env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - files: + files: | node/Cargo.toml commit-message: "upgrade node to ${{ steps.new-version.outputs.version }}" - id: commit - name: push commit run: | git push --set-upstream origin ${{ steps.branch-name.outputs.branch_name }} From 4a68274d4948c95fe5e0942b8820f73489313692 Mon Sep 17 00:00:00 2001 From: b-yap <2826165+b-yap@users.noreply.github.com> Date: Thu, 4 Jul 2024 15:51:11 +0800 Subject: [PATCH 6/9] revert to use swinton/commit --- .github/workflows/node-version-up.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/node-version-up.yml b/.github/workflows/node-version-up.yml index 8eff555e5..d13be5314 100644 --- a/.github/workflows/node-version-up.yml +++ b/.github/workflows/node-version-up.yml @@ -48,7 +48,8 @@ jobs: echo "branch_name=release/upgrade-node-to-${{ steps.new-version.outputs.version }}" >> "$GITHUB_OUTPUT" git checkout -b release/upgrade-node-to-${{ steps.new-version.outputs.version }} - name: commit new version up - uses: chromeq/commit@v2.x + id: commit + uses: swinton/commit@v2.x env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From 7d064d23dcbb358e13d1a906fface35f3f068add Mon Sep 17 00:00:00 2001 From: b-yap <2826165+b-yap@users.noreply.github.com> Date: Thu, 4 Jul 2024 16:42:10 +0800 Subject: [PATCH 7/9] use back chromeq, but without the env --- .github/workflows/node-version-up.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/node-version-up.yml b/.github/workflows/node-version-up.yml index d13be5314..231cffee8 100644 --- a/.github/workflows/node-version-up.yml +++ b/.github/workflows/node-version-up.yml @@ -49,13 +49,14 @@ jobs: git checkout -b release/upgrade-node-to-${{ steps.new-version.outputs.version }} - name: commit new version up id: commit - uses: swinton/commit@v2.x - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: chromeq/commit@v2.x +# env: +# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: files: | node/Cargo.toml commit-message: "upgrade node to ${{ steps.new-version.outputs.version }}" + ref: refs/head/main - name: push commit run: | git push --set-upstream origin ${{ steps.branch-name.outputs.branch_name }} From 251509a82e1fa71a964d461fef50fced5dba3e68 Mon Sep 17 00:00:00 2001 From: b-yap <2826165+b-yap@users.noreply.github.com> Date: Thu, 4 Jul 2024 21:13:07 +0800 Subject: [PATCH 8/9] use graphql instead --- .github/workflows/node-version-up.yml | 43 +++++++++++---------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/.github/workflows/node-version-up.yml b/.github/workflows/node-version-up.yml index 231cffee8..dc9ca846e 100644 --- a/.github/workflows/node-version-up.yml +++ b/.github/workflows/node-version-up.yml @@ -7,12 +7,6 @@ on: description: "node version up: major, minor, or patch" required: true default: "patch" - pull_request: - branches: - - main - push: - branches: - - main jobs: bump-version: @@ -30,12 +24,10 @@ jobs: - name: install cargo-edit run: | cargo install cargo-edit -# - name: set new version ${{ github.event.inputs.versioning }} - - name: set new version + - name: set new version ${{ github.event.inputs.versioning }} continue-on-error: false run: | - cargo set-version --bump patch --package pendulum-node -# cargo set-version --bump ${{ github.event.inputs.versioning }} --package pendulum-node + cargo set-version --bump ${{ github.event.inputs.versioning }} --package pendulum-node - name: save updated version id: new-version run: | @@ -47,24 +39,23 @@ jobs: run: | echo "branch_name=release/upgrade-node-to-${{ steps.new-version.outputs.version }}" >> "$GITHUB_OUTPUT" git checkout -b release/upgrade-node-to-${{ steps.new-version.outputs.version }} + git push --set-upstream origin release/upgrade-node-to-${{ steps.new-version.outputs.version }} - name: commit new version up - id: commit - uses: chromeq/commit@v2.x -# env: -# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - files: | - node/Cargo.toml - commit-message: "upgrade node to ${{ steps.new-version.outputs.version }}" - ref: refs/head/main - - name: push commit run: | - git push --set-upstream origin ${{ steps.branch-name.outputs.branch_name }} + gh api graphql \ + -F githubRepository=${{ github.repository }} \ + -F branchName=${{ steps.branch-name.outputs.branch_name }} \ + -F expectedHeadOid=$(git rev-parse HEAD) \ + -F commitMessage="chore: node upgrade to ${{ steps.new-version.outputs.version }}" \ + -F files[][path]="node/Cargo.toml" -F files[][contents]=$(base64 -w0 node/Cargo.toml) \ + -F 'query=@.github/api/createCommitOnBranch.gql' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: ${{ steps.branch-name.outputs.branch_name }} - name: Create Pull Request - uses: peter-evans/create-pull-request@v6.1.0 + uses: thomaseizinger/create-pull-request@master with: - base: "main" + github_token: ${{ secrets.GITHUB_TOKEN }} title: "release: upgrade node to ${{ steps.new-version.outputs.version }}" - branch: "${{ steps.branch-name.outputs.branch_name }}" - body: "View [CHANGES](https://github.com/${{ github.repository }}/compare/main...release/upgrade-node-to-${{ steps.new-version.outputs.version}})" - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + head: ${{ steps.branch-name.outputs.branch_name }} + base: main \ No newline at end of file From acfe8b2360f0ecaa3f7b3de284fe57730118f1ed Mon Sep 17 00:00:00 2001 From: b-yap <2826165+b-yap@users.noreply.github.com> Date: Fri, 5 Jul 2024 20:08:58 +0800 Subject: [PATCH 9/9] add reviewers --- .github/workflows/node-version-up.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/node-version-up.yml b/.github/workflows/node-version-up.yml index dc9ca846e..638541d14 100644 --- a/.github/workflows/node-version-up.yml +++ b/.github/workflows/node-version-up.yml @@ -17,14 +17,14 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Setup user + - name: Setup User run: | git config user.name github-actions git config user.email github-actions@github.com - name: install cargo-edit run: | cargo install cargo-edit - - name: set new version ${{ github.event.inputs.versioning }} + - name: Set New Version ${{ github.event.inputs.versioning }} continue-on-error: false run: | cargo set-version --bump ${{ github.event.inputs.versioning }} --package pendulum-node @@ -34,13 +34,13 @@ jobs: cd node echo "version=$(cargo metadata --format-version=1 --no-deps | jq '.packages[0].version')" >> "$GITHUB_OUTPUT" cd .. - - name: save branch name + - name: Create Release Branch for version ${{ steps.new-version.outputs.version }} id: branch-name run: | echo "branch_name=release/upgrade-node-to-${{ steps.new-version.outputs.version }}" >> "$GITHUB_OUTPUT" git checkout -b release/upgrade-node-to-${{ steps.new-version.outputs.version }} git push --set-upstream origin release/upgrade-node-to-${{ steps.new-version.outputs.version }} - - name: commit new version up + - name: Commit New Changes to New Branch run: | gh api graphql \ -F githubRepository=${{ github.repository }} \ @@ -58,4 +58,5 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} title: "release: upgrade node to ${{ steps.new-version.outputs.version }}" head: ${{ steps.branch-name.outputs.branch_name }} - base: main \ No newline at end of file + base: main + reviewers: "ebma, TorstenStueber, bogdanS98, gianfra-t, b-yap" \ No newline at end of file