From 7328c0dba9220ec4b8e5e59299f70993f5d27a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=B6=E6=9D=96?= Date: Tue, 10 Dec 2024 23:21:57 +0800 Subject: [PATCH] Add GitHub Actions workflow for automated build and release of DanceKunKun app. This includes steps for checking out the code, setting up Xcode, installing Tuist, generating the Xcode project, building the app, creating a DMG, generating source archives, and generating checksums. The workflow triggers on version tag pushes. --- .github/workflows/release.yml | 89 +++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..29ffffe --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,89 @@ +name: Build and Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + discussions: write + +jobs: + build: + name: Build and Release + runs-on: macos-14 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '16.1' + + - name: Install Tuist + run: | + brew install tuist + + - name: Generate Xcode Project + run: | + tuist generate --no-open + + - name: Build App + run: | + xcodebuild \ + -workspace DanceKunKun.xcworkspace \ + -scheme DanceKunKun \ + -configuration Release \ + -derivedDataPath ./DerivedData \ + -arch arm64 -arch x86_64 \ + clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO + + - name: Create DMG + run: | + brew install create-dmg + create-dmg \ + --volname "DanceKunKun" \ + --window-size 500 300 \ + --icon-size 100 \ + --icon "DanceKunKun.app" 150 150 \ + --app-drop-link 350 150 \ + --no-internet-enable \ + "DanceKunKun.dmg" \ + "DerivedData/Build/Products/Release/DanceKunKun.app" + + - name: Create Source Archives + run: | + zip -r "DanceKunKun-${{ github.ref_name }}-src.zip" . \ + -x "*.git*" -x "build/*" -x "*.xcodeproj/*" -x "*.xcworkspace/*" -x "*.dmg" -x "DerivedData/*" + + - name: Generate Checksums + run: | + echo "### DanceKunKun ${{ github.ref_name }}" > checksums.txt + echo "" >> checksums.txt + echo "- Universal Binary (Apple Silicon + Intel)" >> checksums.txt + echo "- macOS 13.0+" >> checksums.txt + echo "" >> checksums.txt + echo "### SHA-256 Checksums" >> checksums.txt + echo "\`\`\`" >> checksums.txt + shasum -a 256 DanceKunKun.dmg "DanceKunKun-${{ github.ref_name }}-src.zip" >> checksums.txt + echo "\`\`\`" >> checksums.txt + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/v') + with: + files: | + DanceKunKun.dmg + DanceKunKun-${{ github.ref_name }}-src.zip + checksums.txt + body_path: checksums.txt + draft: false + prerelease: ${{ contains(github.ref, '-beta') || contains(github.ref, '-alpha') }} + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file