This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
136 lines (123 loc) · 5.62 KB
/
build.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: CI - Build Application
on:
push:
branches:
- 'main'
paths-ignore:
- 'LICENSE'
- '**.md'
pull_request:
release:
types: [created]
workflow_dispatch:
permissions:
write-all
jobs:
build-mac:
name: Build for macOS (Universal)
runs-on: macOS-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# - name: Set node
# uses: actions/setup-node@v4
# with:
# node-version: 20.x
# - name: Set up Homebrew
# id: set-up-homebrew
# uses: Homebrew/actions/setup-homebrew@master
# - name: Install dependencies
# run: |
# brew install graphicsmagick imagemagick
- name: Set up env.APP_CONF to Debug
if: github.event_name != 'release'
run: |
echo "APP_CONF=Debug" >> $GITHUB_ENV
- name: Set up env.APP_CONF to Release
if: github.event_name == 'release'
run: |
echo "APP_CONF=Release" >> $GITHUB_ENV
APP_VERSION=$(xcrun agvtool mvers -terse1)
APP_BUILD=$(xcrun agvtool vers -terse)
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
echo "APP_BUILD=$APP_BUILD" >> $GITHUB_ENV
- name: Build for macOS (Universal)
shell: bash
run: |
xcodebuild -project 'InjectGUI.xcodeproj' -scheme 'InjectGUI' -configuration '${{ env.APP_CONF }}' -destination 'platform=macOS' build -derivedDataPath 'build'
- name: Create DMG
shell: bash
run: |
hdiutil create -volname "InjectGUI" -srcfolder "build/Build/Products/${{ env.APP_CONF }}/InjectGUI.app" -ov -format UDZO "InjectGUI.dmg"
cp "InjectGUI.dmg" "$RUNNER_TEMP/InjectGUI.dmg"
- name: Upload DMG Artifact
id: upload-artifact
uses: actions/upload-artifact@v4
with:
name: InjectGUI
path: InjectGUI.dmg
- name: Upload DMG to GitHub Release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: InjectGUI.dmg
############################
# Sparkle Appcast
############################
- name: Update Sparkle appcast
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
env:
# SPARKLE_KEY: Sparkle EdDSA key exported from `generate_keys -x` as plain text
# SPARKLE_CHANNEL: Seperate dev builds from default channel, to be specified in [SPUUpdaterDelegate allowedChannelsForUpdater:]
# SPARKLE_DL_PREFIX: Prefix for the URL from where updates will be downloaded
# SPARKLE_LINK: CodeEdit Website
# https://github.com/wibus-wee/InjectGUI/releases/download/0.0.1-alpha.11/CodeEdit-9113dc5.dmg
# RELEASE_NOTES_PREFIX: The URL to prefix before an update link:
# https://codeedit.app/whats-new/raw/{v0.1.0} -- data in {} is inserted by sparkle
# RELEASE_NOTES_URL: The URL of the entire release notes page: https://codeedit.app/whats-new
SPARKLE_KEY: ${{ secrets.SPARKLE_KEY }}
# SPARKLE_CHANNEL: dev
SPARKLE_DL_PREFIX: "https://github.com/wibus-wee/InjectGUI/releases/download"
SPARKLE_LINK: "https://github.com/wibus-wee/InjectGUI"
APP_VERSION: ${{ env.APP_VERSION }}
APP_BUILD: ${{ env.APP_BUILD }}
# RELEASE_NOTES_URL: "https://codeedit.app/whats-new/"
# RELEASE_NOTES_PREFIX: "https://codeedit.app/sparkle/"
run: |
SPARKLE_BIN="$RUNNER_TEMP/build/SourcePackages/artifacts/sparkle/Sparkle/bin"
SPARKLE_ARCHIVE="$RUNNER_TEMP/Sparkle_Archive"
echo -n "$SPARKLE_KEY" | tee "$RUNNER_TEMP/sparkle_key"
mkdir "$SPARKLE_ARCHIVE"
cp "$RUNNER_TEMP/InjectGUI.dmg" "$SPARKLE_ARCHIVE"
SPARKLE_SIG=$("$SPARKLE_BIN/sign_update" --ed-key-file "$RUNNER_TEMP/sparkle_key" "$SPARKLE_ARCHIVE/InjectGUI.dmg" | cut -d\" -f2)
echo "<!DOCTYPE>" > "$SPARKLE_ARCHIVE/InjectGUI.html" # Need a blank html doc with the DOCTYPE tag to trick sparkle into loading our remote release notes.
"$SPARKLE_BIN/generate_appcast" --ed-key-file "$RUNNER_TEMP/sparkle_key" --download-url-prefix "${{ env.SPARKLE_DL_PREFIX }}/v${{ env.APP_VERSION }}/" --link "$SPARKLE_LINK" --maximum-deltas 0 "$SPARKLE_ARCHIVE"
- name: Upload Sparkle Appcast
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: "${{ RUNNER.TEMP }}/Sparkle_Archive/appcast.xml"
- name: Upload Sparkle Artifact
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: appcast.xml
path: "${{ RUNNER.TEMP }}/Sparkle_Archive/appcast.xml"
- name: Find Comment
uses: peter-evans/find-comment@v4
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'InjectGUI v'
- name: Create Pull Request Comment
if: github.event_name == 'pull_request'
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
**InjectGUI** v${{ env.APP_VERSION }} (${env.APP_BUILD}) (`${GITHUB_SHA::8}`) has been built and is available for download.
You can download the latest artifact from here: ${{ steps.upload-artifact.outputs.artifact_url }}
> [!WARNING]
> This is a PR build and may not be stable. It's only for testing purposes.