Skip to content

Commit 86cfa2c

Browse files
[PETOSS-829] Increment version using script from exec hook instead of separate workflow
1 parent bf539b2 commit 86cfa2c

File tree

4 files changed

+28
-111
lines changed

4 files changed

+28
-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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Create Github Release for OpenAPI Spec
22

33
on:
44
workflow_dispatch:
5+
pull_request:
56

67
jobs:
78
create-github-release:
@@ -22,7 +23,14 @@ jobs:
2223
with:
2324
node-version: 20
2425

26+
- name: Get github app access token
27+
id: get_access_token
28+
uses: actions/create-github-app-token@v2
29+
with:
30+
app-id: ${{ vars.XERO_PUBLIC_APP_ID }}
31+
private-key: ${{ secrets.XERO_PUBLIC_BOT_KEY }}
32+
2533
- name: Perform release
26-
run: npx semantic-release
34+
run: npx --package @semantic-release/exec semantic-release --dry-run
2735
env:
28-
GH_TOKEN: ${{ github.token }}
36+
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)