-
Notifications
You must be signed in to change notification settings - Fork 38
164 lines (137 loc) · 5.01 KB
/
update.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#
# Copyright (C) 2022 Ing <https://github.com/wjz304>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
name: update
on:
push:
schedule:
- cron: '0 */6 * * *'
workflow_dispatch:
inputs:
version:
description: 'tag'
required: true
type: string
env:
FORCE_INSTALL: 1
HAS_OPENSSL_BUILD: 1
HAS_OPENSSL_W32BUILD: 0
ACID32: 1
jobs:
build:
runs-on: macos-12
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Checkout
uses: actions/checkout@main
- name: Initialization environment
run : |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
sudo systemsetup -settimezone "Asia/Shanghai"
- name: Install Python Dependencies
run: |
python3 -m pip install -U pip
pip3 install datetime urllib3 wget
- name: Run Updater
run: python3 -u update.py -i sequoia,sonoma,ventura,monterey -t ${{ secrets.GITHUB_TOKEN }}
- name: Check for changes
run: |
if [ -n "$(git status -s | grep -v -w timestamp)" ];then
echo "ischanges=true" >> $GITHUB_ENV
## '$GITHUB_ENV' needs to add 'EOF' when setting multiline text.
# echo "changesbody=$(git status -s | grep -v -w timestamp)" >> $GITHUB_ENV
echo 'changesbody<<EOF' >> $GITHUB_ENV
git status -s | grep -v -w timestamp >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
else
echo "ischanges=false" >> $GITHUB_ENV
fi
echo ischanges: ${{ env.ischanges }}
echo changesbody: ${{ env.changesbody }}
- name: Commit and Push
if: env.ischanges == 'true'
run: |
git add .
git commit -m "update $(date +%Y-%m-%d" "%H:%M:%S)"
git push -f
- name: Generate release tag
if: env.ischanges == 'true' || github.event_name == 'workflow_dispatch'
id: tag
run: |
if [ ${{ env.ischanges }} == 'true' ]; then
echo "release_tag=$(date +"%Y.%m.%d-%H%M")" >> $GITHUB_ENV
else
echo "release_tag=${{ inputs.version }}" >> $GITHUB_ENV
fi
- name: Zip EFI
if: env.ischanges == 'true' || github.event_name == 'workflow_dispatch'
uses: vimtor/[email protected]
with:
files: EFI README.md
recursive: false
dest: ${{ github.event.repository.name }}-${{ env.release_tag }}.zip
- name: Change Sequoia
if: env.ischanges == 'true'
run: python3 -u update.py -c -i sequoia -t ${{ secrets.GITHUB_TOKEN }}
- name: Zip EFI Sequoia
if: env.ischanges == 'true'
uses: vimtor/[email protected]
with:
files: EFI README.md
recursive: false
dest: ${{ github.event.repository.name }}-Sequoia-${{ env.release_tag }}.zip
- name: Change Sonoma
if: env.ischanges == 'true'
run: python3 -u update.py -c -i sonoma -t ${{ secrets.GITHUB_TOKEN }}
- name: Zip EFI Sonoma
if: env.ischanges == 'true'
uses: vimtor/[email protected]
with:
files: EFI README.md
recursive: false
dest: ${{ github.event.repository.name }}-Sonoma-${{ env.release_tag }}.zip
- name: Change Ventura
if: env.ischanges == 'true'
run: python3 -u update.py -c -i ventura -t ${{ secrets.GITHUB_TOKEN }}
- name: Zip EFI Ventura
if: env.ischanges == 'true'
uses: vimtor/[email protected]
with:
files: EFI README.md
recursive: false
dest: ${{ github.event.repository.name }}-Ventura-${{ env.release_tag }}.zip
- name: Change Monterey
if: env.ischanges == 'true'
run: python3 -u update.py -c -i monterey -t ${{ secrets.GITHUB_TOKEN }}
- name: Zip EFI Monterey
if: env.ischanges == 'true'
uses: vimtor/[email protected]
with:
files: EFI README.md
recursive: false
dest: ${{ github.event.repository.name }}-Monterey-${{ env.release_tag }}.zip
- name: Upload firmware to release
if: env.ischanges == 'true' || github.event_name == 'workflow_dispatch'
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.release_tag }}
body: ${{ env.changesbody }}
files: Hackintosh*.zip
prerelease: ${{ env.ischanges }}
#- name: Delete workflow runs
# uses: Mattraks/delete-workflow-runs@v2
# with:
# retain_days: 1
# keep_minimum_runs: 3