feat: Rework Settings UI and UX (#59) #89
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: Build and Release App | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**/*.md' | |
- '**.github/workflows/*' | |
- '**examples/*' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
release: | |
runs-on: macos-14 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Xcode Select Version | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '15' | |
- name: Setup Certificate | |
uses: apple-actions/import-codesign-certs@v2 | |
with: | |
p12-file-base64: ${{ secrets.P12_CERTIFICATE_BASE64 }} | |
p12-password: ${{ secrets.P12_PASSWORD }} | |
- name: Get Next Version | |
id: semver | |
uses: ietf-tools/semver-action@v1 | |
with: | |
skipInvalidTags: true | |
noVersionBumpBehavior: "error" | |
majorList: "major, breaking" | |
token: ${{ env.GITHUB_TOKEN }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Bump version in Config.xcconfig | |
run: | | |
CURRENT_BUILD=$(grep BUILD_NUMBER ishare/Config.xcconfig | cut -d ' ' -f 3) | |
NEW_BUILD=$((CURRENT_BUILD + 1)) | |
sed -i '' "s/BUILD_NUMBER = $CURRENT_BUILD/BUILD_NUMBER = $NEW_BUILD/" ishare/Config.xcconfig | |
CURRENT_VERSION=$(grep VERSION ishare/Config.xcconfig | cut -d ' ' -f 3) | |
NEW_VERSION=${{ steps.semver.outputs.nextStrict }} | |
sed -i '' "s/VERSION = $CURRENT_VERSION/VERSION = $NEW_VERSION/" ishare/Config.xcconfig | |
- name: Build Changelog | |
uses: dlavrenuek/[email protected] | |
id: changelog | |
with: | |
from: ${{ steps.semver.outputs.current }} | |
to: HEAD | |
- name: Build macOS app | |
run: xcodebuild archive -scheme "ishare (external)" -configuration "Release" -archivePath "build/ishare.xcarchive" -destination "generic/platform=macOS,name=Any Mac" | xcbeautify | |
- name: Commit & Push changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: 'ishare/Config.xcconfig' | |
default_author: github_actions | |
fetch: false | |
message: 'Bump version [skip ci]' | |
push: true | |
- name: Sign, Package and Notarize .app | |
run: | | |
cp -R "build/ishare.xcarchive/Products/Applications/"*.app "build/ishare.app" | |
cd build | |
codesign -s "Developer ID Application" -f --timestamp -o runtime --deep "ishare.app/Contents/Frameworks/Sparkle.framework/Versions/B/XPCServices/Downloader.xpc/Contents/MacOS/Downloader" | |
codesign -s "Developer ID Application" -f --timestamp -o runtime --deep "ishare.app/Contents/Frameworks/Sparkle.framework/Versions/B/XPCServices/Installer.xpc/Contents/MacOS/Installer" | |
codesign -s "Developer ID Application" -f --timestamp -o runtime --deep "ishare.app/Contents/Frameworks/Sparkle.framework/Versions/B/Updater.app/Contents/MacOS/Updater" | |
codesign -s "Developer ID Application" -f --timestamp -o runtime --deep "ishare.app/Contents/Frameworks/Sparkle.framework/Versions/B/Autoupdate" | |
codesign -s "Developer ID Application" -f --timestamp -o runtime --deep "ishare.app/Contents/MacOS/ishare (external)" | |
codesign -s "Developer ID Application" -f --timestamp -o runtime --deep "ishare.app" | |
npm install --global create-dmg | |
create-dmg "ishare.app" --overwrite | |
DMG_FILE=$(ls *.dmg) | |
echo "DMG_FILE=$DMG_FILE" >> $GITHUB_ENV | |
xcrun notarytool submit "$DMG_FILE" --wait --apple-id "${{ secrets.NOTARIZATION_USERNAME }}" --password "${{ secrets.NOTARIZATION_PASSWORD }}" --team-id "L988J7YMK5" | |
xcrun stapler staple "$DMG_FILE" | |
- name: Configure Sparkle | |
run: | | |
curl -L -o Sparkle-2.4.2.tar.xz https://github.com/sparkle-project/Sparkle/releases/download/2.4.2/Sparkle-2.4.2.tar.xz | |
tar -xJf Sparkle-2.4.2.tar.xz | |
mkdir update | |
mv "./build/$DMG_FILE" update/ | |
echo "${{ steps.changelog.outputs.body }}" > RELEASE.md | |
chmod +x ./bin/generate_appcast | |
- name: Convert Markdown to HTML | |
uses: jaywcjlove/markdown-to-html-cli@main | |
with: | |
source: RELEASE.md | |
output: ./update/${DMG_FILE%.dmg}.html | |
github-corners: false | |
- name: Generate appcast.xml | |
run: echo "$EDDSA_PRIVATE_KEY" | ./bin/generate_appcast --ed-key-file - --link https://isharemac.app --embed-release-notes --download-url-prefix https://github.com/castdrian/ishare/releases/latest/download/ update/ | |
env: | |
EDDSA_PRIVATE_KEY: ${{ secrets.EDDSA_PRIVATE_KEY }} | |
ARCHIVES_SOURCE_DIR: . | |
- name: Archive appcast.xml as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: appcast | |
path: ./update/appcast.xml | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.semver.outputs.next }} | |
body_path: RELEASE.md | |
files: ./update/*.dmg | |
fail_on_unmatched_files: true | |
token: ${{ env.GITHUB_TOKEN }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
pages: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: release | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download appcast.xml artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: appcast | |
path: ./ | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Build with Jekyll | |
uses: actions/jekyll-build-pages@v1 | |
with: | |
source: ./ | |
destination: ./_site | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |