Skip to content

Commit 56d6d26

Browse files
update release process to create and merge PRs instead of force pushing
1 parent c5a88ff commit 56d6d26

File tree

6 files changed

+52
-18
lines changed

6 files changed

+52
-18
lines changed
Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: Bump build version
22
description: Bumps SemVer buildVersion in the input builder-config file
33
inputs:
4-
build-config-file:
5-
description: File path to the builder config yaml file
4+
platform:
5+
description: Platform to update builder config yaml file
6+
required: true
7+
token:
8+
description: GitHub token
69
required: true
710
commit:
811
description: If true, will add and commit the new build version. Default false.
@@ -15,11 +18,17 @@ outputs:
1518
runs:
1619
using: "composite"
1720
steps:
21+
- name: Get build config file
22+
id: filepath
23+
run: |
24+
echo "build-config-file=web/build/builder-${{ inputs.platform }}-config.yaml" >> $GITHUB_OUTPUT
25+
shell: bash
26+
1827
- name: Get current build version
1928
id: current-build-version
2029
run: |
21-
version="$(yq '.buildVersion' ${{ inputs.build-config-file }})"
22-
echo "Current buildVersion in ${{ inputs.build-config-file }} is $version"
30+
version="$(yq '.buildVersion' ${{ steps.filepath.outputs.build-config-file }})"
31+
echo "Current buildVersion in ${{ steps.filepath.outputs.build-config-file }} is $version"
2332
echo "version=$version" >> $GITHUB_OUTPUT
2433
shell: bash
2534

@@ -30,15 +39,24 @@ runs:
3039
current_version: ${{ steps.current-build-version.outputs.version }}
3140
level: patch
3241

33-
- name: Update ${{ inputs.build-config-file }} buildVersion
42+
- name: Update ${{ steps.filepath.outputs.build-config-file }} buildVersion
3443
run: |
35-
yq -i '.buildVersion = "${{ steps.bump-version.outputs.new_version }}"' ${{ inputs.build-config-file }}
36-
echo "New buildVersion in ${{ inputs.build-config-file }} is ${{ steps.bump-version.outputs.new_version }}"
44+
yq -i '.buildVersion = "${{ steps.bump-version.outputs.new_version }}"' ${{ steps.filepath.outputs.build-config-file }}
45+
echo "New buildVersion in ${{ steps.filepath.outputs.build-config-file }} is ${{ steps.bump-version.outputs.new_version }}"
3746
shell: bash
3847

3948
- name: Add and commit new build version
4049
if: ${{ inputs.commit == 'true' }}
4150
uses: EndBug/add-and-commit@v9
4251
with:
43-
message: "Update ${{ inputs.build-config-file }} buildVersion to ${{ steps.bump-version.outputs.new_version }}"
44-
pull: origin
52+
message: "Update ${{ steps.filepath.outputs.build-config-file }} buildVersion to ${{ steps.bump-version.outputs.new_version }} [skip ci]"
53+
new_branch: release/${{ inputs.platform }}-${{ steps.bump-version.outputs.new_version }}
54+
55+
- name: Raise PR and merge
56+
if: ${{ inputs.commit == 'true' }}
57+
run: |
58+
gh pr create --base main --head release/${{ inputs.platform }}-${{ steps.bump-version.outputs.new_version }} --title "Update ${{ steps.filepath.outputs.build-config-file }} buildVersion to ${{ steps.bump-version.outputs.new_version }}" --body "Increment version"
59+
gh pr merge --merge --delete-branch release/${{ inputs.platform }}-${{ steps.bump-version.outputs.new_version }}
60+
env:
61+
GITHUB_TOKEN: ${{ inputs.token }}
62+
shell: bash

.github/workflows/cd-release-dmg.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ jobs:
2525
- name: Bump build version
2626
uses: ./.github/actions/bump-build-version
2727
with:
28-
build-config-file: web/build/builder-dmg-config.yaml
28+
platform: dmg
29+
token: ${{ secrets.GITHUB_TOKEN }}
2930

3031
- uses: actions/setup-node@v4
3132
with:
@@ -104,5 +105,6 @@ jobs:
104105

105106
- uses: ./.github/actions/bump-build-version
106107
with:
107-
build-config-file: web/build/builder-dmg-config.yaml
108+
platform: dmg
109+
token: ${{ secrets.GITHUB_TOKEN }}
108110
commit: true

.github/workflows/cd-release-linux.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ jobs:
2525
- name: Bump linux build version
2626
uses: ./.github/actions/bump-build-version
2727
with:
28-
build-config-file: web/build/builder-linux-config.yaml
28+
platform: linux
29+
token: ${{ secrets.GITHUB_TOKEN }}
2930

3031
- uses: actions/setup-node@v4
3132
with:
@@ -70,6 +71,7 @@ jobs:
7071

7172
- uses: ./.github/actions/bump-build-version
7273
with:
73-
build-config-file: web/build/builder-linux-config.yaml
74+
platform: linux
75+
token: ${{ secrets.GITHUB_TOKEN }}
7476
commit: true
7577

.github/workflows/cd-release-mas.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ jobs:
2626
id: bump-mas-version
2727
uses: ./.github/actions/bump-build-version
2828
with:
29-
build-config-file: web/build/builder-mas-config.yaml
29+
platform: mas
30+
token: ${{ secrets.GITHUB_TOKEN }}
3031

3132
- uses: actions/setup-node@v4
3233
with:
@@ -97,5 +98,6 @@ jobs:
9798

9899
- uses: ./.github/actions/bump-build-version
99100
with:
100-
build-config-file: web/build/builder-mas-config.yaml
101+
platform: mas
102+
token: ${{ secrets.GITHUB_TOKEN }}
101103
commit: true

.github/workflows/cd-release-windows.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ jobs:
2929
- name: Bump Windows build version
3030
uses: ./.github/actions/bump-build-version
3131
with:
32-
build-config-file: web/build/builder-win-config.yaml
32+
platform: win
33+
token: ${{ secrets.GITHUB_TOKEN }}
3334

3435
- uses: actions/setup-node@v4
3536
with:
@@ -82,5 +83,6 @@ jobs:
8283

8384
- uses: ./.github/actions/bump-build-version
8485
with:
85-
build-config-file: web/build/builder-win-config.yaml
86+
platform: win
87+
token: ${{ secrets.GITHUB_TOKEN }}
8688
commit: true

.github/workflows/cd-release.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ jobs:
4141
- name: Add and commit new version
4242
uses: EndBug/add-and-commit@v9
4343
with:
44-
message: "Update web/package.json version to ${{ needs.format-version.outputs.version }}"
44+
message: "Update web/package.json version to ${{ needs.format-version.outputs.version }} [skip ci]"
45+
new_branch: release/${{ needs.format-version.outputs.version }}
46+
47+
- name: Raise PR and merge
48+
run: |
49+
gh pr create --base main --head release/${{ needs.format-version.outputs.version }} --title "Update web/package.json version to ${{ needs.format-version.outputs.version }}" --body "Increment version"
50+
gh pr merge --merge --delete-branch release/${{ needs.format-version.outputs.version }}
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4553

4654
- name: Create Release
4755
id: create_release

0 commit comments

Comments
 (0)