fix: ? #49
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Create Release" | |
on: | |
push: | |
branches: | |
- "release/**" | |
pull_request: | |
branches: | |
- "release/**" | |
types: | |
- ready_for_review | |
- opened | |
workflow_dispatch: | |
concurrency: | |
group: publish-release | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
pull-requests: read | |
env: | |
projname: "Matchumbeop" | |
beta-channel-name: "beta" | |
jobs: | |
preparation: | |
name: Preparation job | |
if: github.event.pull_request.draft == false | |
runs-on: macos-14 | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract latest changes | |
id: latest_changes | |
run: | | |
python3 ./.github/releaser/generate_latest_changes.py | |
- name: Check if version already released | |
run: | | |
if [[ $(xcrun agvtool what-version -terse) == $(cat new_version) ]]; then | |
echo "Version already released" >> $GITHUB_STEP_SUMMARY | |
exit 1 | |
fi | |
- name: Check if release notes are empty | |
run: | | |
if [[ $(cat latest_changes) == "" ]]; then | |
echo "Release notes are empty" >> $GITHUB_STEP_SUMMARY | |
exit 1 | |
fi | |
- name: Save generated info | |
uses: actions/upload-artifact@v4 | |
with: | |
path: | | |
new_version | |
title | |
latest_changes | |
- name: Clean up generated files for sync | |
run: | | |
rm latest_changes | |
rm title | |
rm new_version | |
archive: | |
name: Build and export app | |
runs-on: macos-14 | |
needs: preparation | |
environment: production | |
permissions: | |
contents: read | |
pull-requests: read | |
steps: | |
- uses: actions/download-artifact@master # download all previously generated artifacts | |
with: | |
path: artifacts | |
- name: Parse info generated in preparation job | |
id: info | |
run: | | |
echo "new_version=$(cat artifacts/artifact/new_version)" >> $GITHUB_OUTPUT | |
echo "title=$(cat artifacts/artifact/title)" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v4 | |
- uses: irgaly/xcode-cache@v1 | |
with: | |
key: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }} | |
restore-keys: xcode-cache-deriveddata-${{ github.workflow }}- | |
- name: Override versions in project # set new version in project | |
run: | | |
sed -i '' "s/_VERSION = $(xcrun agvtool what-version -terse)/_VERSION = ${{ steps.info.outputs.new_version }}/g" Matchumbeop/${{ env.projname }}.xcodeproj/project.pbxproj; | |
- name: | |
Install the Apple certificate and provisioning profile | |
# install the Apple certificate and provisioning profile | |
# following https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development | |
env: | |
MAC_DEV_CERT_BASE64: ${{ secrets.MAC_DEV_CERT_BASE64 }} | |
DEVELOPER_ID_CERT_BASE64: ${{ secrets.DEVELOPER_ID_CERT_BASE64 }} | |
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
run: | | |
# create variables | |
# CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
MAC_DEV_CERT_PATH=$RUNNER_TEMP/mac_dev_cert.p12 | |
DEVELOPER_ID_CERT_PATH=$RUNNER_TEMP/developer_id_cert.p12 | |
# import certificate and provisioning profile from secrets | |
# echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH | |
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH | |
echo -n "$MAC_DEV_CERT_BASE64" | base64 --decode --output $MAC_DEV_CERT_PATH | |
echo -n "$DEVELOPER_ID_CERT_BASE64" | base64 --decode --output $DEVELOPER_ID_CERT_PATH | |
# create temporary keychain | |
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
# import certificate to keychain | |
# security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security import $MAC_DEV_CERT_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security import $DEVELOPER_ID_CERT_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
# apply provisioning profile | |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles | |
- name: Switch Xcode version # Force Xcode version (macOS runner has multiple Xcode versions installed) | |
run: | | |
sudo xcode-select -s "/Applications/Xcode_15.4.app" | |
/usr/bin/xcodebuild -version | |
- name: setup-cocoapods | |
uses: maxim-lobanov/setup-cocoapods@v1 | |
with: | |
podfile-path: Matchumbeop/Podfile.lock | |
- name: Pod Install | |
run: | | |
cd Matchumbeop | |
pod install | |
- name: Build and archive # create archive | |
run: | | |
xcodebuild archive -workspace Matchumbeop/${{ env.projname }}.xcworkspace -list | |
xcodebuild clean archive -workspace Matchumbeop/${{ env.projname }}.xcworkspace -scheme ${{ env.projname }} -archivePath ${{ env.projname }} -destination 'generic/platform=macOS' | |
- name: Export app # create .app | |
run: xcodebuild -exportArchive -archivePath "${{ env.projname }}.xcarchive" -exportPath Release -exportOptionsPlist ".github/releaser/export_options.plist" | |
- name: Zip app # zip .app | |
run: | | |
cd Release | |
ditto -c -k --sequesterRsrc --keepParent ${{ env.projname }}.app ${{ env.projname }}.zip # todo check perhaps cd .. missing | |
- name: Notary App | |
run: | | |
cd Release | |
echo "notarizing ${{ env.projname }}.zip" | |
xcrun notarytool submit ${{ env.projname }}.zip --team-id N7V29V6Q33 --apple-id ${{ env.NOTARY_ID }} --password ${{ env.NOTARY_PASSWORD }} --wait | |
# echo "stapling ${{ env.projname }}.zip" | |
# xcrun stapler staple ${{ env.projname }}.zip | |
env: | |
NOTARY_ID: ${{ secrets.NOTARY_ID }} | |
NOTARY_PASSWORD: ${{ secrets.NOTARY_PASSWORD }} | |
- name: Upload achived app | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app | |
path: Release/${{ env.projname }}.zip | |
release: | |
name: "Create Release" | |
runs-on: macos-14 | |
environment: production | |
needs: archive | |
permissions: | |
contents: write | |
packages: write | |
actions: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@master | |
with: | |
path: artifacts | |
- name: Parse info generated in preparation job | |
id: info | |
run: | | |
echo "new_version=$(cat artifacts/artifact/new_version)" >> $GITHUB_OUTPUT | |
echo "title=$(cat artifacts/artifact/title)" >> $GITHUB_OUTPUT | |
mv artifacts/artifact/new_version new_version | |
mv artifacts/artifact/title title | |
mv artifacts/artifact/latest_changes latest_changes | |
mkdir Release | |
mv artifacts/app/${{ env.projname }}.zip Release/ | |
- name: Prepare Sparkle update creation | |
env: | |
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }} | |
run: | | |
echo -n "$SPARKLE_PRIVATE_KEY" > ./.github/releaser/sparkle_private_key | |
rm -rf Release/*.app | |
rm -rf Release/*.log | |
rm -rf Release/*.plist | |
- name: Preparate Sparkle | |
run: | | |
pip3 install --break-system-packages -r .github/releaser/requirements.txt | |
python3 ./.github/releaser/generate_html_for_sparkle_release.py | |
mv Release/latest_changes.html Release/${{ env.projname }}.html | |
python3 ./.github/releaser/remove_last_item_appcast.py | |
- name: Update appcast | |
run: | | |
./.github/releaser/generate_appcast \ | |
--ed-key-file .github/releaser/sparkle_private_key \ | |
--link https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases \ | |
--download-url-prefix https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases/download/${{ steps.info.outputs.new_version }}/ \ | |
-o docs/Support/appcast.xml \ | |
Release/ | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ steps.info.outputs.new_version }} - ${{ steps.info.outputs.title }} | |
tag_name: ${{ steps.info.outputs.new_version }} | |
fail_on_unmatched_files: true | |
body_path: latest_changes | |
files: Release/${{ env.projname }}.zip | |
prerelease: ${{ steps.channel.outputs.prerelease }} | |
- name: Saving changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
file_pattern: | | |
docs/Support/appcast.xml | |
Matchumbeop/${{ env.projname }}.xcodeproj/project.pbxproj | |
commit_message: "chore(release): update version to ${{ steps.info.outputs.new_version }}" | |
- name: Create summary | |
run: | | |
echo "Release ${{ steps.info.outputs.new_version }} created." > $GITHUB_STEP_SUMMARY | |
ending: | |
name: Ending job | |
if: always() | |
runs-on: ubuntu-24.04 | |
needs: [release] | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Merge PR | |
uses: devmasx/merge-branch@v1 | |
with: | |
type: now | |
from_branch: ${{ steps.comment-branch.outputs.head_ref }} | |
target_branch: ${{ steps.comment-branch.outputs.base_ref }} | |
github_token: ${{ github.token }} | |
message: "chore(release): update version to ${{ steps.info.outputs.new_version }}" | |
- uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: "*" |