-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (49 loc) · 2.16 KB
/
release_notes.yml
File metadata and controls
56 lines (49 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Update Release Notes from Fastlane Metadata
on:
release:
types: [published]
jobs:
update-release-notes:
runs-on: ubuntu-latest
steps:
# Step 1. Check out the repository so that we have access to all the files.
- name: Checkout repository
uses: actions/checkout@v3
# Step 2. Extract the version code from pubspec.yml.
# Assumes your pubspec.yml contains a line like: version: 1.0.0+123
- name: Extract version code from pubspec.yml
id: extract_version
run: |
echo "Extracting version code from pubspec.yml..."
# Extract everything after the plus sign.
VERSION_CODE=$(grep '^version:' pubspec.yaml | sed 's/.*+//')
if [ -z "$VERSION_CODE" ]; then
echo "Unable to extract version code from pubspec.yml"
exit 1
fi
echo "VERSION_CODE=${VERSION_CODE}" >> $GITHUB_ENV
echo "::set-output name=version_code::$VERSION_CODE"
echo "Extracted version code: $VERSION_CODE"
# Optional: display the version code.
- name: Display version code
run: echo "Version code is ${{ env.VERSION_CODE }}"
# Step 3. Verify the changelog file exists using the extracted version code.
- name: Verify changelog file exists
run: |
FILE_PATH="fastlane/metadata/android/en-US/changelogs/${{ env.VERSION_CODE }}.txt"
if [ ! -f "$FILE_PATH" ]; then
echo "Changelog file not found at $FILE_PATH"
exit 1
fi
echo "Found changelog file at $FILE_PATH"
# Step 4. Use the GitHub CLI to update the release with the changelog contents.
- name: Update release notes using GitHub CLI
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
FILE_PATH="fastlane/metadata/android/en-US/changelogs/${{ env.VERSION_CODE }}.txt"
echo "Updating release notes from file: $FILE_PATH"
echo "Changelog content:"
cat "$FILE_PATH"
# Update the release (the release tag is available from the event payload)
gh release edit "${{ github.event.release.tag_name }}" --notes-file "$FILE_PATH"