Skip to content

Commit 731d27e

Browse files
committed
ci
Signed-off-by: Lessica <82flex@gmail.com>
1 parent 095227f commit 731d27e

2 files changed

Lines changed: 135 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Build DayNightSwitch
2+
3+
on:
4+
push:
5+
branches: [ release ]
6+
workflow_dispatch:
7+
8+
env:
9+
FINALPACKAGE: 1
10+
HOMEBREW_NO_AUTO_UPDATE: 1
11+
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
12+
13+
jobs:
14+
build:
15+
runs-on: macos-14
16+
17+
strategy:
18+
matrix:
19+
scheme: ['', 'rootless', 'roothide']
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Install dependencies
26+
run: |
27+
# Install xcbeautify for build output formatting
28+
# Install ldid for iOS code signing
29+
# Install 7zip for compression
30+
brew install xcbeautify ldid-procursus p7zip make
31+
32+
- name: Checkout roothide/theos
33+
uses: actions/checkout@v4
34+
with:
35+
repository: roothide/theos
36+
path: theos-roothide
37+
submodules: recursive
38+
39+
- name: Install iOS SDKs
40+
run: |
41+
export THEOS=$GITHUB_WORKSPACE/theos-roothide
42+
cd theos-roothide
43+
./bin/install-sdk iPhoneOS16.5
44+
./bin/install-sdk iPhoneOS14.5
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Setup Xcode
49+
uses: maxim-lobanov/setup-xcode@v1
50+
with:
51+
xcode-version: '16.2'
52+
53+
- name: Build package (${{ matrix.scheme || 'default' }})
54+
run: |
55+
cd Tweak
56+
export THEOS=$GITHUB_WORKSPACE/theos-roothide
57+
THEOS_PACKAGE_SCHEME=${{ matrix.scheme }} FINALPACKAGE=1 gmake clean package
58+
59+
- name: Prepare artifacts
60+
run: |
61+
cd Tweak
62+
63+
# Create directories for artifacts
64+
mkdir -p artifacts/dsym-${{ matrix.scheme || 'default' }}
65+
mkdir -p artifacts/packages-${{ matrix.scheme || 'default' }}
66+
67+
# Copy dSYM files
68+
if [ -d ".theos/obj" ]; then
69+
find .theos/obj -name "*.dSYM" -exec cp -r {} artifacts/dsym-${{ matrix.scheme || 'default' }}/ \;
70+
fi
71+
72+
# Copy packages
73+
if [ -d "packages" ]; then
74+
cp -r packages/* artifacts/packages-${{ matrix.scheme || 'default' }}/
75+
fi
76+
77+
- name: Upload dSYM artifacts
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: dsym-${{ matrix.scheme || 'default' }}
81+
path: Tweak/artifacts/dsym-${{ matrix.scheme || 'default' }}
82+
if-no-files-found: warn
83+
84+
- name: Upload package artifacts
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: packages-${{ matrix.scheme || 'default' }}
88+
path: Tweak/artifacts/packages-${{ matrix.scheme || 'default' }}
89+
if-no-files-found: warn
90+
91+
release:
92+
if: github.event_name == 'push' && github.ref == 'refs/heads/release'
93+
needs: build
94+
runs-on: macos-14
95+
96+
steps:
97+
- name: Checkout repository
98+
uses: actions/checkout@v4
99+
100+
- name: Download all package artifacts
101+
uses: actions/download-artifact@v4
102+
with:
103+
pattern: packages-*
104+
path: release-packages
105+
merge-multiple: true
106+
107+
- name: Create release tag
108+
id: tag
109+
run: |
110+
# Read PACKAGE_VERSION from Makefile
111+
PACKAGE_VERSION=$(grep 'PACKAGE_VERSION' Tweak/Makefile | cut -d' ' -f4)
112+
TAG_NAME="v$PACKAGE_VERSION"
113+
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
114+
115+
- name: Create GitHub Release
116+
uses: softprops/action-gh-release@v1
117+
with:
118+
tag_name: ${{ steps.tag.outputs.tag_name }}
119+
name: Release ${{ steps.tag.outputs.tag_name }}
120+
body: |
121+
Automated build from release branch
122+
123+
This release contains packages built with:
124+
- Default scheme
125+
- Rootless scheme
126+
- Roothide scheme
127+
128+
Built on: ${{ github.sha }}
129+
files: release-packages/**/*
130+
draft: false
131+
prerelease: false

Tweak/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
export PACKAGE_VERSION := 1.2
2+
13
ARCHS := arm64 arm64e
24
TARGET := iphone:clang:16.5:14.0
35

46
include $(THEOS)/makefiles/common.mk
57

68
TWEAK_NAME := DayNightSwitch
7-
DayNightSwitch_FILES += Tweak.xm DayNightSwitch.m
9+
DayNightSwitch_FILES += Tweak.xm
10+
DayNightSwitch_FILES += DayNightSwitch.m
811
DayNightSwitch_CFLAGS += -fobjc-arc
912

1013
include $(THEOS_MAKE_PATH)/tweak.mk

0 commit comments

Comments
 (0)