Skip to content

Commit 374d405

Browse files
committed
ci(android & desktop): create release automatically
1 parent d8866d9 commit 374d405

File tree

1 file changed

+164
-0
lines changed

1 file changed

+164
-0
lines changed
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: Create release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tagname:
7+
description: 'Version name'
8+
required: true
9+
default: 'v*.*.*'
10+
type: string
11+
12+
jobs:
13+
build-linux:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup JDK
20+
# TODO: replace this once https://github.com/actions/setup-java/pull/637 gets merged.
21+
uses: gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d
22+
with:
23+
java-version: '17'
24+
distribution: 'jetbrains'
25+
cache: 'gradle'
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Package
30+
run: |
31+
./gradlew application:packageReleaseTarGz
32+
./gradlew application:packageReleaseDeb
33+
./gradlew application:packageReleaseRpm
34+
35+
- name: Prepare packages
36+
run: |
37+
mkdir -p binaries
38+
mv application/build/distribution/*.tar.gz binaries/
39+
mv application/build/compose/binaries/main-release/deb/*.deb binaries/
40+
mv application/build/compose/binaries/main-release/rpm/*.rpm binaries/
41+
42+
- name: Upload packages
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: NeoRegex-linux
46+
path: binaries/*
47+
48+
build-windows:
49+
runs-on: windows-latest
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v4
53+
54+
- name: Setup JDK
55+
# TODO: replace this once https://github.com/actions/setup-java/pull/637 gets merged.
56+
uses: gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d
57+
with:
58+
java-version: '17'
59+
distribution: 'jetbrains'
60+
cache: 'gradle'
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
64+
- name: Package exe
65+
run: ./gradlew application:packageReleaseExe
66+
67+
- name: Upload
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: NeoRegex-windows
71+
path: application/build/compose/binaries/main-release/exe/*.exe
72+
73+
build-macos:
74+
runs-on: macos-latest
75+
steps:
76+
- name: Checkout
77+
uses: actions/checkout@v4
78+
79+
- name: Setup JDK
80+
# TODO: replace this once https://github.com/actions/setup-java/pull/637 gets merged.
81+
uses: gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d
82+
with:
83+
java-version: '17'
84+
distribution: 'jetbrains'
85+
cache: 'gradle'
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
89+
- name: Package dmg
90+
run: ./gradlew application:packageReleaseDmg
91+
92+
- name: Upload dmg
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: NeoRegex-macos
96+
path: application/build/compose/binaries/main-release/dmg/*.dmg
97+
98+
build-android:
99+
runs-on: ubuntu-latest
100+
steps:
101+
- name: Checkout
102+
uses: actions/checkout@v4
103+
104+
- name: Setup JDK
105+
uses: actions/setup-java@v4
106+
with:
107+
java-version: '17'
108+
distribution: 'zulu'
109+
cache: 'gradle'
110+
111+
- name: Setup Android SDK
112+
uses: android-actions/setup-android@v3
113+
114+
- name: Decode Keystore
115+
run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > keystore.jks
116+
117+
- name: Decode Properties
118+
run: echo "${{ secrets.KEYSTORE_PROPERTIES_BASE64 }}" | base64 --decode > keystore.properties
119+
120+
- name: Build apk
121+
run: ./gradlew assembleRelease
122+
123+
- name: Upload apk
124+
uses: actions/upload-artifact@v4
125+
with:
126+
name: NeoRegex-android
127+
path: application/build/outputs/apk/release/*.apk
128+
129+
create-release:
130+
needs: [build-windows, build-android, build-linux, build-macos]
131+
runs-on: ubuntu-latest
132+
env:
133+
DOWNLOADS_PATH: ./downloaded-artifacts
134+
135+
steps:
136+
- name: Download window
137+
uses: actions/download-artifact@v4
138+
with:
139+
name: NeoRegex-windows
140+
path: ${{ env.DOWNLOADS_PATH }}
141+
142+
- name: Download linux
143+
uses: actions/download-artifact@v4
144+
with:
145+
name: NeoRegex-linux
146+
path: ${{ env.DOWNLOADS_PATH }}
147+
148+
- name: Download macOS
149+
uses: actions/download-artifact@v4
150+
with:
151+
name: NeoRegex-macos
152+
path: ${{ env.DOWNLOADS_PATH }}
153+
154+
- name: Download android
155+
uses: actions/download-artifact@v4
156+
with:
157+
name: NeoRegex-android
158+
path: ${{ env.DOWNLOADS_PATH }}
159+
160+
- name: Create release
161+
uses: softprops/action-gh-release@v2
162+
with:
163+
files: ${{ env.DOWNLOADS_PATH }}/*
164+
tag_name: ${{ github.event.inputs.tagname }}

0 commit comments

Comments
 (0)