Skip to content

Commit

Permalink
chore: update Github Action workflows
Browse files Browse the repository at this point in the history
Signed-off-by: samzong <samzong.lu@gmail.com>
  • Loading branch information
samzong committed Dec 29, 2024
1 parent dadc903 commit 0c70b79
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 128 deletions.
61 changes: 0 additions & 61 deletions .github/workflows/build-and-release.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/pr-check.yml
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.'
})
67 changes: 0 additions & 67 deletions .github/workflows/pr-test.yml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/release.yml
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

0 comments on commit 0c70b79

Please sign in to comment.