feat: 🎸 Localize untranslated strings #83
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
# ref: https://github.com/rxhanson/Rectangle/blob/master/.github/workflows/build.yml | |
name: Build | |
on: | |
workflow_dispatch: | |
push: | |
branches-ignore: | |
- 'gh-pages' | |
- 'website' | |
paths-ignore: | |
- '*.md' | |
- '*.txt' | |
- '.github/workflows/jekyll.yml' | |
pull_request: | |
env: | |
XCODE_SCHEME: "EjectKey" | |
BUILD_DIR: "build" | |
XCODE_ARCHIVE: "EjectKey.xcarchive" | |
EXPORT_OPTIONS_PLIST: "exportOptions.plist" | |
CODE_SIGN_IDENTITY: "-" | |
APP_NAME: "EjectKey.app" | |
ZIP_BASE_NAME: "EjectKey" | |
ZIP_FILE_NAME: "EjectKey.zip" | |
DEVELOPER_DIR: /Applications/Xcode_14.3.app/Contents/Developer | |
jobs: | |
build: | |
runs-on: macos-13 | |
steps: | |
- name: Show Xcode version | |
run: xcodebuild -version | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get Version Number | |
run: | | |
echo "VERSION=$(cat version.txt)" >> "$GITHUB_ENV" | |
echo "BUILD=$(git rev-list HEAD --count)" >> "$GITHUB_ENV" | |
- name: Set Version Number | |
run: | | |
sed -i '' -e "s/MARKETING_VERSION = .*;/MARKETING_VERSION = $VERSION;/" "$XCODE_SCHEME.xcodeproj/project.pbxproj" | |
xcrun agvtool new-version -all $BUILD | |
- name: Cache Swift Packages | |
uses: actions/cache@v3 | |
with: | |
path: SourcePackages | |
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-spm- | |
- name: Build | |
run: xcodebuild -scheme "$XCODE_SCHEME" archive CODE_SIGN_IDENTITY="$CODE_SIGN_IDENTITY" -archivePath "$BUILD_DIR/$XCODE_ARCHIVE" -skipPackagePluginValidation -clonedSourcePackagesDirPath SourcePackages | |
- name: Export | |
run: | | |
plutil -convert xml1 - -o "$EXPORT_OPTIONS_PLIST" << EOF | |
{ | |
"destination": "export", | |
"method": "mac-application" | |
} | |
EOF | |
xcodebuild -exportArchive -archivePath "$BUILD_DIR/$XCODE_ARCHIVE" -exportPath "$BUILD_DIR" -exportOptionsPlist "$EXPORT_OPTIONS_PLIST" | |
- name: Resign App | |
run: codesign --force --deep -s "$CODE_SIGN_IDENTITY" "$BUILD_DIR/$APP_NAME" | |
- name: Compress ZIP | |
run: zip -ry "$ZIP_FILE_NAME" "$APP_NAME" | |
working-directory: ${{ env.BUILD_DIR }} | |
- name: Move ZIP | |
run: mv "$BUILD_DIR/$ZIP_FILE_NAME" "$ZIP_FILE_NAME" | |
- name: Upload ZIP | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ZIP | |
path: ${{ env.ZIP_FILE_NAME }} | |
update_release_draft: | |
runs-on: macOS-13 | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Download ZIP | |
uses: actions/download-artifact@v3 | |
with: | |
name: ZIP | |
- name: Generate Private Key File | |
run: echo -n "$SPARKLE_PRIVATE_KEY" > sparkle_private_key | |
env: | |
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }} | |
- name: Generate Signature | |
run: | | |
echo "SIGNATURE=$(SourcePackages/artifacts/sparkle/bin/sign_update -p $ZIP_FILE_NAME -f sparkle_private_key)" >> "$GITHUB_ENV" | |
- name: Get Version Number | |
run: | | |
echo "VERSION=$(cat version.txt)" >> "$GITHUB_ENV" | |
echo "BUILD=$(git rev-list HEAD --count)" >> "$GITHUB_ENV" | |
- name: Rename ZIP | |
run: mv *.zip "$ZIP_BASE_NAME-$VERSION.zip" | |
- name: Create Release Draft | |
id: create-draft | |
uses: release-drafter/release-drafter@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: v${{ env.VERSION }} | |
tag: v${{ env.VERSION }}b${{ env.BUILD }} | |
footer: "<!-- sparkle:edSignature=${{ env.SIGNATURE }} -->" | |
- name: Upload ZIP # Upload the zip first, because the first item in the asset list is referenced when generating appcast.xml | |
uses: shogo82148/actions-upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create-draft.outputs.upload_url }} | |
asset_path: ${{ env.ZIP_BASE_NAME }}-${{ env.VERSION }}.zip | |
overwrite: true |