Update build-and-release.yml #19
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 | |
on: | |
push: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Build | |
run: | | |
xcodebuild clean build \ | |
-project MacMusicPlayer.xcodeproj \ | |
-scheme MacMusicPlayer \ | |
-archivePath $PWD/build/MacMusicPlayer.xcarchive \ | |
-configuration Release \ | |
-sdk macosx \ | |
-destination 'generic/platform=macOS,name=Any Mac' \ | |
CODE_SIGN_IDENTITY="" \ | |
CODE_SIGNING_REQUIRED=NO \ | |
ONLY_ACTIVE_ARCH=NO \ | |
ARCHS="x86_64 arm64" | |
- name: Create app | |
run: | | |
xcodebuild -exportArchive \ | |
-archivePath $PWD/build/MacMusicPlayer.xcarchive \ | |
-exportOptionsPlist exportOptions.plist \ | |
-exportPath $PWD/build/export | |
- name: Prepare for DMG | |
run: | | |
mkdir -p dist | |
mv build/export/MacMusicPlayer.app dist/ | |
ls -R dist | |
- name: Create DMG | |
run: | | |
hdiutil create -volname MacMusicPlayer \ | |
-srcfolder dist \ | |
-ov -format UDZO dist/MacMusicPlayer.dmg | |
- name: Create Release and Upload Asset | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create v${{ github.run_number }} \ | |
--title "Release ${{ github.run_number }}" \ | |
--notes "Release ${{ github.run_number }}" \ | |
./dist/MacMusicPlayer.dmg |