-
Notifications
You must be signed in to change notification settings - Fork 15
197 lines (178 loc) · 6.64 KB
/
build.yaml
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: Build
on:
workflow_dispatch:
push:
branches: [ main ]
tags: [ v* ]
pull_request:
branches: [ main ]
jobs:
build-with-zulu:
name: ${{ matrix.os }}(${{ matrix.type }}) ${{ matrix.arch }} with Auzl Zulu
runs-on: ${{ matrix.label }}
strategy:
fail-fast: false
matrix:
include:
- { label: windows-latest, os: Windows, arch: x86_64, type: msi }
- { label: windows-latest, os: Windows, arch: x86_64, type: app-image }
- { label: macos-13, os: macOS, arch: x86_64, type: dmg }
- { label: macos-13, os: macOS, arch: x86_64, type: pkg }
- { label: macos-13, os: macOS, arch: x86_64, type: app-image }
- { label: macos-latest, os: macOS, arch: aarch64, type: dmg }
- { label: macos-latest, os: macOS, arch: aarch64, type: pkg }
- { label: macos-latest, os: macOS, arch: aarch64, type: app-image }
steps:
- name: Checkout MiniLPA
uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build Native Executable
shell: pwsh
run: |
./scripts/Build.ps1 -NativeExecutable -NativeExecutableType ${{ matrix.type }}
- name: Get Short Commit Id
shell: pwsh
run: |
"SHORT_COMMIT_ID=$($Env:GITHUB_SHA.Substring(0, 7))" | Out-File -FilePath $Env:GITHUB_ENV -Append
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: MiniLPA-${{ env.SHORT_COMMIT_ID }}-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.type }}
path: |
build/dist/
build-with-jbr:
name: ${{ matrix.os }}(${{ matrix.type }}) ${{ matrix.arch }} ${{ matrix.wayland && 'Wayland' || '' }} with JetBrains Runtime
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
type: [ deb, rpm, app-image ]
wayland: [ true, false ]
include:
- os: Linux
- arch: x86_64
steps:
- name: Checkout MiniLPA
uses: actions/checkout@v4
- name: Checkout JetBrains Setup
uses: actions/checkout@v4
with:
repository: ShiinaSekiu/github-actions-jbr-setup
ref: jdk
path: .github/shared_actions/jbr
- name: Install JetBrains Runtime
uses: ./.github/shared_actions/jbr/setup_jbr21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build Native Executable
shell: pwsh
run: |
./scripts/Build.ps1 -NativeExecutable -NativeExecutableType ${{ matrix.type }} -NativeWayland:$${{ matrix.wayland }} -GithubToken ${{ secrets.GITHUB_TOKEN }}
- name: Get Short Commit Id
shell: pwsh
run: |
"SHORT_COMMIT_ID=$($Env:GITHUB_SHA.Substring(0, 7))" | Out-File -FilePath $Env:GITHUB_ENV -Append
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: MiniLPA-${{ env.SHORT_COMMIT_ID }}-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.type }}${{ matrix.wayland && '-Wayland' || '' }}
path: |
build/dist/
canary-telegram:
name: Canary(Telegram)
runs-on: macos-latest
needs: [ build-with-zulu, build-with-jbr ]
if: "!startsWith(github.ref, 'refs/tags/v')"
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
steps:
- name: Checkout Scripts
uses: actions/checkout@v4
if: env.TELEGRAM_TOKEN != ''
with:
sparse-checkout: scripts
- name: Setup Python
uses: actions/setup-python@v5
if: env.TELEGRAM_TOKEN != ''
with:
python-version: 'pypy3.10'
cache: 'pip'
- name: Download Artifact
uses: actions/download-artifact@v4
if: env.TELEGRAM_TOKEN != ''
with:
merge-multiple: true
path: artifact
- name: Telegram Push
shell: pwsh
if: env.TELEGRAM_TOKEN != ''
run: |
pip install -r scripts/requirements.txt
python scripts/telegrampush.py -token '${{ secrets.TELEGRAM_TOKEN }}' -target '@MiniLPACanary' -path "$(Get-Location)/artifact/" -message "\[[$($Env:GITHUB_SHA.Substring(0, 7))](${{ github.event.head_commit.url }})\] ${{ github.event.head_commit.message }}”
release-telegram:
name: Release(Telegram)
runs-on: macos-latest
needs: [ build-with-zulu, build-with-jbr ]
if: startsWith(github.ref, 'refs/tags/v')
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
steps:
- name: Checkout Scripts
uses: actions/checkout@v4
if: env.TELEGRAM_TOKEN != ''
with:
sparse-checkout: scripts
- name: Setup Python
uses: actions/setup-python@v5
if: env.TELEGRAM_TOKEN != ''
with:
python-version: 'pypy3.10'
cache: 'pip'
- name: Download Artifact
uses: actions/download-artifact@v4
if: env.TELEGRAM_TOKEN != ''
with:
merge-multiple: true
path: artifact
- name: Telegram Push
shell: pwsh
if: env.TELEGRAM_TOKEN != ''
run: |
pip install -r scripts/requirements.txt
python scripts/telegrampush.py -token '${{ secrets.TELEGRAM_TOKEN }}' -target '@MiniLPA' -path "$(Get-Location)/artifact/" -message "🎉 $("${{ github.ref_name }}".Replace(".", "\.")) Released\! 🎉`n[GitHub Release](https://github.com/EsimMoe/MiniLPA/releases/tag/$("${{ github.ref_name }}".Replace(".", "\.")))”
release-github:
name: Release(GitHub)
runs-on: macos-latest
needs: [ build-with-zulu, build-with-jbr ]
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Get Artifact SHA256
id: artifact-hash
shell: pwsh
run: |
'sha256<<EOF' | Out-File -Path $Env:GITHUB_OUTPUT -Append
Get-ChildItem | ForEach-Object { (Get-FileHash $_.FullName -Algorithm SHA256).Hash + ' ' + $_.Name | Out-File -Path $Env:GITHUB_OUTPUT -Append }
'EOF' | Out-File -Path $Env:GITHUB_OUTPUT -Append
- name: GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
append_body: true
body: |
## Artifacts SHA256 Hashes
```
${{ steps.artifact-hash.outputs.sha256 }}
```
files: '*'