-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (77 loc) · 2.51 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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: |
# 生成基于时间戳的构建号(格式:YYYYMMDDHHmm)
BUILD_NUMBER=$(date "+%Y%m%d%H%M")
# 替换 Project.swift 中的占位符
sed -i '' "s/@BUILD_NUMBER@/$BUILD_NUMBER/g" Project.swift
echo "Build number set to: $BUILD_NUMBER"
tuist generate --no-open
- name: Build App
run: |
xcodebuild \
-workspace V2Bar.xcworkspace \
-scheme V2Bar \
-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 "V2Bar" \
--window-size 500 300 \
--icon-size 100 \
--icon "V2Bar.app" 150 150 \
--app-drop-link 350 150 \
--no-internet-enable \
"V2Bar.dmg" \
"DerivedData/Build/Products/Release/V2Bar.app"
- name: Generate Checksums
run: |
echo "### V2Bar ${{ 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 V2Bar.dmg >> checksums.txt
echo "\`\`\`" >> checksums.txt
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
V2Bar.dmg
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 }}