Update CI workflows

* add ai release notes to the release

no new user features
---------

Co-authored-by: Violet Caulfield <violet@cosmonautical.cloud>
This commit is contained in:
Ritesh Shukla
2025-05-31 17:31:36 +05:30
committed by GitHub
parent 2892f49764
commit ca58dbfcec
2 changed files with 182 additions and 50 deletions

View File

@@ -1,11 +1,96 @@
name: Publish Android APK and TestFlight Betas
on:
workflow_dispatch:
inputs:
build-platform:
description: 'Select the platform to build'
required: true
default: 'Both'
type: choice
options:
- Android
- iOS
- Both
version-bump:
description: 'Version bump type'
required: true
default: 'No Bump'
type: choice
options:
- No Bump
- minor
- patch
- major
jobs:
publish-beta:
publish-android:
if: ${{ github.event.inputs['build-platform'] == 'Android' || github.event.inputs['build-platform'] == 'Both' }}
runs-on: macos-15
outputs:
version: ${{ steps.setver.outputs.version }}
steps:
- name: 🛒 Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.SIGNING_REPO_PAT }}
- name: 🖥 Setup Node 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: 🍎 Run yarn init-android
run: yarn init-android
- name: + Version Up
if: ${{ github.event.inputs['version-bump'] != 'No Bump' }}
run: yarn react-native bump-version --type ${{ github.event.inputs['version-bump'] }}
- id: setver
run: echo "version=$(node -p -e "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: 💬 Echo package.json version to Github ENV
run: echo VERSION_NUMBER=$(node -p -e "require('./package.json').version") >> $GITHUB_ENV
- name: 🤫 Output TelemetryDeck Secrets to TelemetryDeck.json
run: |
echo "{" > telemetrydeck.json
echo "\"appID\": \"${{ secrets.TELEMETRYDECK_APPID }}\"," >> telemetrydeck.json
echo "\"clientUser\": \"anonymous\"," >> telemetrydeck.json
echo "\"app\": \"Jellify\"" >> telemetrydeck.json
echo "}" >> telemetrydeck.json
- name: 🤫 Output Glitchtip Secrets to Glitchtip.json
run: |
echo "{" > glitchtip.json
echo "\"dsn\": \"${{ secrets.GLITCHTIP_DSN }}\"" >> glitchtip.json
echo "}" >> glitchtip.json
- name: ✅ Validate Config Files
run: |
node -e "JSON.parse(require('fs').readFileSync('telemetrydeck.json'))"
node -e "JSON.parse(require('fs').readFileSync('glitchtip.json'))"
- name: 🚀 Run Android fastlane build
run: yarn fastlane:android:build
- name: 📤 Upload Android Artifacts
uses: actions/upload-artifact@v4
with:
name: android-artifacts
path: ./android/app/build/outputs/apk/release/*.apk
publish-iOS:
if: ${{ github.event.inputs['build-platform'] == 'iOS' || github.event.inputs['build-platform'] == 'Both' }}
runs-on: macos-15
outputs:
version: ${{ steps.setver.outputs.version }}
steps:
- name: 🛒 Checkout
uses: actions/checkout@v4
with:
@@ -19,8 +104,12 @@ jobs:
- name: 🍎 Run yarn init-ios:new-arch
run: yarn init-ios:new-arch
- name: Version Up
run: yarn react-native bump-version --type patch
- name: + Version Up
if: ${{ github.event.inputs['version-bump'] != 'No Bump' }}
run: yarn react-native bump-version --type ${{ github.event.inputs['version-bump'] }}
- id: setver
run: echo "version=$(node -p -e "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: 💬 Echo package.json version to Github ENV
run: echo VERSION_NUMBER=$(node -p -e "require('./package.json').version") >> $GITHUB_ENV
@@ -44,12 +133,9 @@ jobs:
echo "\"dsn\": \"${{ secrets.GLITCHTIP_DSN }}\"" >> glitchtip.json
echo "}" >> glitchtip.json
- name: ✅ Validate TelemetryDeck.json
- name: ✅ Validate Config Files
run: |
node -e "JSON.parse(require('fs').readFileSync('telemetrydeck.json'))"
- name: ✅ Validate Glitchtip.json
run: |
node -e "JSON.parse(require('fs').readFileSync('glitchtip.json'))"
- name: 🚀 Run iOS fastlane build and publish to TestFlight
@@ -60,63 +146,109 @@ jobs:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_REPO_PAT: "anultravioletaurora:${{ secrets.SIGNING_REPO_PAT }}"
- name: 🚀 Run Android fastlane build
run: yarn fastlane:android:build
- name: 📤 Upload iOS Artifact
uses: actions/upload-artifact@v4
with:
name: ios-artifacts
path: ./ios/Jellify.ipa
- name: 👩‍💻 Configure Git
run: |
git config --global user.email "violet@cosmonautical.cloud"
git config --global user.name "anultravioletaurora"
git remote set-url origin https://x-access-token:${{ secrets.SIGNING_REPO_PAT }}@github.com/Jellify-Music/App.git
finalize-release:
needs: [publish-android, publish-ios]
runs-on: macos-15
steps:
- name: 🛒 Checkout Repo
uses: actions/checkout@v4
with:
token: ${{ secrets.SIGNING_REPO_PAT }}
- name: ⬇️ Download Android Artifacts
if: ${{ github.event.inputs['build-platform'] == 'Android' || github.event.inputs['build-platform'] == 'Both' }}
uses: actions/download-artifact@v4
with:
name: android-artifacts
path: artifacts/
- name: 🧹 Clean up Glitchtip and TelemetryDeck files
run: |
git restore telemetrydeck.json
git restore glitchtip.json
# Commit Fastlane Xcode build number increment
- name: 🔢 Commit changes for version increment
run: |
git add package.json
git add ios/Jellify.xcodeproj/project.pbxproj
git add android/app/build.gradle
git commit -m "[skip actions]"
git push origin main
- name: ⬇️ Download iOS Artifacts
if: ${{ github.event.inputs['build-platform'] == 'iOS' || github.event.inputs['build-platform'] == 'Both' }}
uses: actions/download-artifact@v4
with:
name: ios-artifacts
path: artifacts/
- name: 🔢 Set artifact version numbers
run: |
# Create artifacts folder for uploading to release
mkdir artifacts
VERSION=${{ needs.publish-ios.outputs.version || needs.publish-android.outputs.version }}
mkdir final-artifacts
# Move the iOS IPA
mv ./ios/Jellify.ipa ./artifacts/Jellify-${{ env.VERSION_NUMBER }}.ipa
# Rename IPA
if [ -f artifacts/ios-artifacts/Jellify.ipa ]; then
cp artifacts/ios-artifacts/Jellify.ipa "final-artifacts/Jellify-${VERSION}.ipa"
fi
# Move and rename all android release APKs
for apk in ./android/app/build/outputs/apk/release/*.apk; do
filename=$(basename "$apk")
newname="Jellify-${{ env.VERSION_NUMBER }}-${filename}"
cp "$apk" "./artifacts/$newname"
done
# Rename APKs
if [ -d artifacts/android-artifacts ]; then
for apk in artifacts/android-artifacts/*.apk; do
filename=$(basename "$apk")
cp "$apk" "final-artifacts/Jellify-${VERSION}-${filename}"
done
fi
- name: 🎉 Create Github release
- name: 🔢 Commit version bump if any
if: ${{ github.event.inputs['version-bump'] != 'No Bump' }}
run: |
git config --global user.name "anultravioletaurora"
git config --global user.email "violet@jellify.app"
git add package.json ios/Jellify.xcodeproj/project.pbxproj android/app/build.gradle || true
git commit -m "[skip actions] version bump" || echo "No changes to commit"
git push origin main
- name: 🧠 Get commit messages for this release
id: commits
run: |
echo "messages<<EOF" >> $GITHUB_OUTPUT
git log --pretty=format:"- %s" $(git describe --tags --abbrev=0)..HEAD >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: ✨ Generate Release Notes with ChatGPT
id: ai_release_notes
run: |
RELEASE_BODY=$(curl -s https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"messages": [
{"role": "system", "content": "You are a helpful assistant that writes concise and friendly mobile app release notes from commit messages."},
{"role": "system", "content": "You are writing release notes for a mobile app called Jellify. The app is a music player that allows you to play music from your library and stream music from the internet."},
{"role": "system", "content": "You are a music enthusiast and you love music related puns and jokes. You can lightly add a pun or joke to the release notes if it's relevant to the release."},
{"role": "system", "content": "Release notes should be concise and helpful to any user of the app - regardless of their technical knowledge."},
{"role": "system", "content": "Release notes should be written in a way that is easy to understand and follow."},
{"role": "user", "content": "Write a release summary based on these commit messages:\n'"${{ steps.commits.outputs.messages }}"'"}
],
"temperature": 0.7
}' | jq -r '.choices[0].message.content')
echo "release_notes<<EOF" >> $GITHUB_OUTPUT
echo "$RELEASE_BODY" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: 🎉 Create Unified GitHub Release
uses: ncipollo/release-action@v1
id: githubRelease
with:
artifacts: "./artifacts/*"
name: ${{ env.VERSION_NUMBER }}
generateReleaseNotes: true
artifacts: ./final-artifacts/*
name: ${{ needs.publish-ios.outputs.version || needs.publish-android.outputs.version }}
tag: ${{ needs.publish-ios.outputs.version || needs.publish-android.outputs.version }}
body: ${{ steps.ai_release_notes.outputs.release_notes }}
prerelease: true
tag: ${{ env.VERSION_NUMBER }}
token: ${{ secrets.SIGNING_REPO_PAT }}
- name: 🗣️ Notify on Discord
run: |
cd ios
bundle exec fastlane notifyOnDiscord
bundle install && bundle exec fastlane notifyOnDiscord
cd ..
env:
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
APP_VERSION: ${{ env.VERSION_NUMBER }}
release_url: ${{ steps.githubRelease.outputs.html_url }}
APP_VERSION: ${{ needs.publish-ios.outputs.version || needs.publish-android.outputs.version }}
release_url: ${{ steps.githubRelease.outputs.html_url }}