From 9e46c2c688037ad6c6d82a4fe72c96cf13cab5e1 Mon Sep 17 00:00:00 2001 From: Kai Azim Date: Tue, 25 Jun 2024 20:22:31 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20Add=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-loop.yml | 74 -------- .github/workflows/dev-build.yml | 159 ++++++++++++++++++ ...V).xcscheme => Loop (GH ACTIONS).xcscheme} | 40 +---- assets/ExportOptions.plist | 18 ++ 4 files changed, 178 insertions(+), 113 deletions(-) delete mode 100644 .github/workflows/build-loop.yml create mode 100644 .github/workflows/dev-build.yml rename Loop.xcodeproj/xcshareddata/xcschemes/{Loop (DEV).xcscheme => Loop (GH ACTIONS).xcscheme} (61%) create mode 100644 assets/ExportOptions.plist diff --git a/.github/workflows/build-loop.yml b/.github/workflows/build-loop.yml deleted file mode 100644 index d0a99d22..00000000 --- a/.github/workflows/build-loop.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Build Loop - -on: - push: - branches: - - develop - workflow_dispatch: - -jobs: - build: - name: Build Loop - runs-on: macos-14 - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: latest-stable - - - name: Install dependencies - run: | - brew install xcbeautify create-dmg - - - name: Build Loop.app - run: | - set -o pipefail && xcodebuild archive \ - -project ./Loop.xcodeproj \ - -destination "generic/platform=macOS" \ - -scheme "Loop" \ - -configuration Debug \ - -archivePath "./Build/Loop.xcarchive" \ - -xcconfig "./Loop/Config.xcconfig" \ - CODE_SIGNING_REQUIRED=NO \ - CODE_SIGNING_ALLOWED=NO \ - CODE_SIGN_IDENTITY= \ - CODE_SIGN_ENTITLEMENTS= \ - GCC_OPTIMIZATION_LEVEL=s \ - SWIFT_OPTIMIZATION_LEVEL=-O \ - GCC_GENERATE_DEBUGGING_SYMBOLS=YES \ - DEBUG_INFORMATION_FORMAT=dwarf-with-dsym | xcbeautify - - - name: Make DMG - run: | - create-dmg \ - --volname "Loop" \ - --background "./assets/graphics/dmg-background.png" \ - --window-pos 200 120 \ - --window-size 660 400 \ - --icon-size 160 \ - --icon "Loop.app" 180 170 \ - --hide-extension "Loop.app" \ - --app-drop-link 480 170 \ - --no-internet-enable \ - "./Build/Loop.dmg" \ - "./Build/Loop.xcarchive/Products/Applications/" - - - name: Upload DMG - uses: actions/upload-artifact@v4 - with: - name: Loop.dmg - path: Build/Loop.dmg - - - name: Make ZIP - run: | - cp -R ./Build/Loop.xcarchive/Products/Applications/ ./Build/ - ditto -c -k --sequesterRsrc --keepParent ./Build/Loop.app ./Build/Loop.zip - - - name: Upload ZIP - uses: actions/upload-artifact@v4 - with: - name: Loop.zip - path: Build/Loop.zip diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml new file mode 100644 index 00000000..33e9498a --- /dev/null +++ b/.github/workflows/dev-build.yml @@ -0,0 +1,159 @@ +name: Loop Development Build + +on: + workflow_dispatch: + workflow_call: + +jobs: + pre-release: + name: Build and Publish Pre-release + runs-on: macos-14 + permissions: + contents: write + pull-requests: read + steps: + - name: โฌ‡๏ธ Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: ๐Ÿงช Set Version and Build number + run: | + # CHANGE EVERY RELEASE: + APP_VERSION="๐Ÿงช 1.1.0" + APP_BUILD=$(git rev-list --count HEAD) + + # Set VERSION + latest_tag=$APP_VERSION + echo "Latest tag: $latest_tag" + sed -i -e "/VERSION =/ s/= .*/= $latest_tag/" Loop/Config.xcconfig + + # Set BUILD_NUMBER + latest_commit_number=$APP_BUILD + echo "Latest commit number: $latest_commit_number" + sed -i -e "/BUILD_NUMBER =/ s/= .*/= $latest_commit_number/" Loop/Config.xcconfig + + echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV + echo "APP_BUILD=$APP_BUILD" >> $GITHUB_ENV + + - name: ๐Ÿ”ง Select Xcode + run: sudo xcode-select -s "/Applications/Xcode_15.4.app" + + - name: ๐ŸŽŸ๏ธ Install Certificate + env: + DEVELOPMENT_CERT_BASE64: ${{ secrets.DEVELOPMENT_CERT_BASE64 }} + DEVELOPER_ID_CERT_BASE64: ${{ secrets.DEVELOPER_ID_CERT_BASE64 }} + P12_PASSWORD: ${{ secrets.P12_PASSWORD }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + run: | + DEVELOPMENT_CERT_PATH=$RUNNER_TEMP/dev.p12 + DEVELOPER_ID_CERT_PATH=$RUNNER_TEMP/devid.p12 + KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db + + echo -n "$DEVELOPMENT_CERT_BASE64" | base64 --decode -o $DEVELOPMENT_CERT_PATH + echo -n "$DEVELOPER_ID_CERT_BASE64" | base64 --decode -o $DEVELOPER_ID_CERT_PATH + + security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + security set-keychain-settings -lut 21600 $KEYCHAIN_PATH + security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + + security import $DEVELOPMENT_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 + + - name: ๐Ÿ› ๏ธ Build Loop + run: | + xcodebuild \ + archive \ + -project Loop.xcodeproj/ \ + -scheme "Loop (GH ACTIONS)" \ + -destination 'generic/platform=macOS' \ + -archivePath dist/Loop.xcarchive + + - name: ๐Ÿฅก Export Loop.app + run: | + xcodebuild \ + -exportArchive \ + -archivePath dist/Loop.xcarchive \ + -exportPath dist/ \ + -exportOptionsPlist assets/ExportOptions.plist \ + -allowProvisioningUpdates + + - name: ๐Ÿค Compress Loop + run: | + ditto -c -k --sequesterRsrc --keepParent "dist/Loop.app" "dist/Loop.zip" + + - name: โœ… Notarize Loop + env: + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ID_PWD: ${{ secrets.APPLE_ID_PWD }} + run: | + xcrun notarytool store-credentials Loop --apple-id "$APPLE_ID" --team-id "$APPLE_TEAM_ID" --password "$APPLE_ID_PWD" + xcrun notarytool submit "dist/Loop.zip" --keychain-profile "Loop" --wait + xcrun stapler staple "dist/Loop.app" + + - name: โฌ†๏ธ Upload Loop + uses: actions/upload-artifact@v4 + with: + name: Loop.zip + path: dist/Loop.app + + - name: ๐Ÿท๏ธ Create/update tag + uses: actions/github-script@v7 + with: + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/tags/prerelease', + sha: context.sha + }).catch(err => { + if (err.status !== 422) throw err; + github.rest.git.updateRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'tags/prerelease', + sha: context.sha + }); + }) + + - name: ๐Ÿ“ฐ Build Changelog + uses: mikepenz/release-changelog-builder-action@v4 + with: + outputFile: CHANGELOG.md + configurationJson: | + { + "template": "#{{CHANGELOG}}\n## ๐Ÿ’ญ Uncategorized\n#{{UNCATEGORIZED}}", + "pr_template": "- ##{{NUMBER}} #{{TITLE}}\n", + "categories": [ + { + "title": "## โœจ New Features", + "labels": ["Feature", "Localization", "Luminare"] + }, + { + "title": "## ๐Ÿž Bug Fixes", + "labels": ["Bug"] + } + ], + "empty_template": "- โŒ No changes found" + } + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: ๐Ÿฅณ Publish Dev Build + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: dist/Loop.zip + commit: main + bodyFile: CHANGELOG.md + name: ${{ env.APP_VERSION }} (${{ env.APP_BUILD }}) + prerelease: true + draft: true + tag: "prerelease" + + - name: ๐Ÿงน Cleanup + run: | + security delete-keychain "$RUNNER_TEMP/app-signing.keychain-db" diff --git a/Loop.xcodeproj/xcshareddata/xcschemes/Loop (DEV).xcscheme b/Loop.xcodeproj/xcshareddata/xcschemes/Loop (GH ACTIONS).xcscheme similarity index 61% rename from Loop.xcodeproj/xcshareddata/xcschemes/Loop (DEV).xcscheme rename to Loop.xcodeproj/xcshareddata/xcschemes/Loop (GH ACTIONS).xcscheme index b77e4217..3a7a5715 100644 --- a/Loop.xcodeproj/xcshareddata/xcschemes/Loop (DEV).xcscheme +++ b/Loop.xcodeproj/xcshareddata/xcschemes/Loop (GH ACTIONS).xcscheme @@ -1,48 +1,10 @@ + version = "1.3"> - - - - - - - - - - - - - - - - - - - - + + + + compileBitcode + + method + developer-id + signingStyle + automatic + stripSwiftSymbols + + teamID + 5F967GYF84 + thinning + <none> + + \ No newline at end of file