Skip to content

Commit c469a3c

Browse files
Copilothaavamoa
andcommitted
Auto-detect commit SHA from DUI version in CHANGELOG and update release description
Co-authored-by: haavamoa <2527084+haavamoa@users.noreply.github.com>
1 parent 47d8256 commit c469a3c

1 file changed

Lines changed: 27 additions & 8 deletions

File tree

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

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ on:
44
workflow_dispatch:
55
inputs:
66
arena_mobil_version:
7-
description: 'Arena Mobil version (e.g. 4.4.0)'
7+
description: 'Arena Mobile version (e.g. 4.4.0)'
88
required: true
99
default: '4.4.0'
10-
commit_sha:
11-
description: 'Commit SHA to tag (full SHA of the DUI version commit)'
10+
dui_version:
11+
description: 'DUI version used in this Arena Mobile release (e.g. 54.4.7)'
1212
required: true
13-
default: 'e5fbfae8d8f16c83c83f59ba5715a2d97dd4525d'
13+
default: '54.4.7'
1414

1515
permissions:
1616
contents: write
@@ -19,15 +19,34 @@ jobs:
1919
create-release:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- name: Create Arena Mobil release
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Fetch all remote branches
28+
run: git fetch --all
29+
30+
- name: Detect commit SHA from DUI version in CHANGELOG
31+
id: detect_sha
32+
run: |
33+
SHA=$(git log --all -S "## [${{ inputs.dui_version }}]" --format="%H" -- CHANGELOG.md | head -1)
34+
if [ -z "$SHA" ]; then
35+
echo "Error: Could not find a commit introducing '## [${{ inputs.dui_version }}]' in CHANGELOG.md"
36+
exit 1
37+
fi
38+
echo "commit_sha=$SHA" >> $GITHUB_OUTPUT
39+
echo "Found commit SHA: $SHA"
40+
41+
- name: Create Arena Mobile release
2342
uses: actions/github-script@v7
2443
with:
2544
script: |
2645
const version = '${{ inputs.arena_mobil_version }}';
27-
const commitSha = '${{ inputs.commit_sha }}';
46+
const commitSha = '${{ steps.detect_sha.outputs.commit_sha }}';
2847
const tagName = `arena-mobil-${version}`;
2948
const releaseName = `Arena Mobil ${version}`;
30-
const body = `This version of DUI was used in Arena Mobil ${version} app.`;
49+
const body = `This version of DUI was used in Arena Mobil ${version} app. Available in App Store and Google Play.`;
3150
try {
3251
await github.rest.repos.createRelease({
3352
owner: context.repo.owner,
@@ -39,7 +58,7 @@ jobs:
3958
draft: false,
4059
prerelease: false
4160
});
42-
console.log(`Release ${tagName} created successfully`);
61+
console.log(`Release ${tagName} created successfully at ${commitSha}`);
4362
} catch (e) {
4463
const isAlreadyExistsError =
4564
e.status === 422 &&

0 commit comments

Comments
 (0)