-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update Github Action workflows
Signed-off-by: samzong <samzong.lu@gmail.com>
- Loading branch information
Showing
4 changed files
with
117 additions
and
128 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: PR Check | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
paths-ignore: | ||
- '**.md' | ||
- '.gitignore' | ||
- '.github/**' | ||
- '!.github/workflows/**' | ||
|
||
jobs: | ||
build: | ||
name: Build and Test | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- 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 \ | ||
CODE_SIGNING_ALLOWED=NO | ||
- name: Check Build Status | ||
if: failure() | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
core.setFailed('Build failed. Please check the build logs for details.') | ||
- name: Comment PR | ||
if: failure() | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: '❌ Build failed. Please check the build logs and fix the issues before merging.' | ||
}) |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
release: | ||
name: Create Release | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Xcode | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: latest-stable | ||
|
||
- name: Get version from tag | ||
id: get_version | ||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
|
||
- name: Build | ||
run: | | ||
xcodebuild clean archive -project MacMusicPlayer.xcodeproj \ | ||
-scheme MacMusicPlayer \ | ||
-archivePath ./build/MacMusicPlayer.xcarchive \ | ||
CODE_SIGN_IDENTITY="" \ | ||
CODE_SIGNING_REQUIRED=NO \ | ||
CODE_SIGNING_ALLOWED=NO | ||
- name: Create DMG | ||
run: | | ||
# Create a temporary directory for mounting | ||
TEMP_DIR=$(mktemp -d) | ||
# Create a DMG | ||
hdiutil create -volname "MacMusicPlayer" -srcfolder "./build/MacMusicPlayer.xcarchive/Products/Applications/MacMusicPlayer.app" \ | ||
-ov -format UDZO "MacMusicPlayer-${{ env.VERSION }}.dmg" | ||
- name: Generate Release Notes | ||
id: release_notes | ||
run: | | ||
echo "## MacMusicPlayer ${{ env.VERSION }}" > release_notes.md | ||
echo "" >> release_notes.md | ||
echo "### 更新内容" >> release_notes.md | ||
echo "- 请查看具体提交记录了解详细更新内容" >> release_notes.md | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: MacMusicPlayer ${{ env.VERSION }} | ||
body_path: release_notes.md | ||
draft: false | ||
prerelease: false | ||
files: | | ||
MacMusicPlayer-${{ env.VERSION }}.dmg | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Update Latest Tag | ||
run: | | ||
git tag -f latest | ||
git push origin latest --force |