Skip to content

0.3.9

0.3.9 #47

Workflow file for this run

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"