Skip to content

Commit 90410d1

Browse files
[PETOSS-829] Increment version using script from exec hook instead of separate workflow (#769)
1 parent bf539b2 commit 90410d1

File tree

4 files changed

+27
-111
lines changed

4 files changed

+27
-111
lines changed

.github/workflows/create-github-pr.yml

Lines changed: 0 additions & 107 deletions
This file was deleted.

.github/workflows/create-github-release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ jobs:
2222
with:
2323
node-version: 20
2424

25+
- name: Get github app access token
26+
id: get_access_token
27+
uses: actions/create-github-app-token@v2
28+
with:
29+
app-id: ${{ vars.XERO_PUBLIC_APP_ID }}
30+
private-key: ${{ secrets.XERO_PUBLIC_BOT_KEY }}
31+
2532
- name: Perform release
26-
run: npx semantic-release
33+
run: npx --package @semantic-release/exec semantic-release
2734
env:
28-
GH_TOKEN: ${{ github.token }}
35+
GH_TOKEN: ${{ steps.get_access_token.outputs.token }}

.releaserc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
}
1616
],
1717
[
18-
"@semantic-release/github",
18+
"@semantic-release/exec",
1919
{
20-
"draftRelease": true
20+
"prepareCmd": "./update-version.sh ${nextRelease.version}"
2121
}
2222
],
23+
"@semantic-release/github",
2324
"@semantic-release/commit-analyzer"
2425
]
2526
}

scripts/update-version.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
versionNumber=${1:?Version number is required as first argument}
4+
branchName=${2:-master}
5+
6+
git checkout "$branchName"
7+
8+
for file in xero*.yaml; do
9+
yq eval --no-colors --prettyPrint ".info.version = \"$versionNumber\"" -i "$file"
10+
echo "updated version in $file to $versionNumber"
11+
done
12+
13+
git add xero*.yaml
14+
git commit -m "chore: bump version to $versionNumber"
15+
git push origin "$branchName"

0 commit comments

Comments
 (0)