Skip to content

auto build dmg

auto build dmg #1

# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
name: Build and Release
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: macos-latest
steps:
- 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 -destination 'platform=macOS' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
- name: Create DMG
run: |
mkdir -p dist
mv build/Release/MacMusicPlayer.app dist/
hdiutil create -volname MacMusicPlayer -srcfolder dist -ov -format UDZO dist/MacMusicPlayer.dmg
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release ${{ github.run_number }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/MacMusicPlayer.dmg
asset_name: MacMusicPlayer.dmg
asset_content_type: application/x-apple-diskimage