-
Notifications
You must be signed in to change notification settings - Fork 3
132 lines (111 loc) · 4.33 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
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Build for Android
on:
release:
types:
- published
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 18
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '18'
- name: Get Latest Release
id: release
uses: InsonusK/get-latest-release@v1.1.0
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
view_top: 1
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
${{ github.workspace }}/lemmyredirect/build/*
${{ github.workspace }}/mastodonredirect/build/*
key: ${{ runner.os }}-gradle-android-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-android-
- name: Build Lemmy Redirect
run: |
./gradlew :lemmyredirect:packageRelease
./gradlew --stop
- name: Build Mastodon Redirect
run: |
./gradlew :mastodonredirect:packageRelease
./gradlew --stop
- name: Upload Lemmy Redirect Logs
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: lemmyredirect_logs
path: ${{ github.workspace }}/lemmyredirect/build/outputs/logs/
- name: Upload Mastodon Redirect Logs
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: mastodonredirect_logs
path: ${{ github.workspace }}/mastodonredirect/build/outputs/logs/
- name: Check Lemmy Redirect Exists
run: ls -laR ${{ github.workspace }}/lemmyredirect/build/outputs/apk/
- name: Check Mastodon Redirect Exists
run: ls -laR ${{ github.workspace }}/mastodonredirect/build/outputs/apk/
- name: Sign Lemmy Redirect
id: sign_lemmy_redirect
uses: zacharee/zipalign-sign-android-release@1.1.3
with:
releaseDirectory: lemmyredirect/build/outputs/apk/release
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
alias: ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_SIGNING_KEY_PWD }}
keyPassword: ${{ secrets.ANDROID_SIGNING_KEY_PWD }}
- name: Sign Mastodon Redirect
id: sign_mastodon_redirect
uses: zacharee/zipalign-sign-android-release@1.1.3
with:
releaseDirectory: mastodonredirect/build/outputs/apk/release
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
alias: ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_SIGNING_KEY_PWD }}
keyPassword: ${{ secrets.ANDROID_SIGNING_KEY_PWD }}
- name: Upload Lemmy Redirect
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: Lemmy Redirect
path: ${{ steps.sign_lemmy_redirect.outputs.signedReleaseFile }}
- name: Upload Mastodon Redirect
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: Mastodon Redirect
path: ${{ steps.sign_mastodon_redirect.outputs.signedReleaseFile }}
- name: Add Lemmy Redirect to Release
uses: ncipollo/release-action@v1
with:
artifacts: ${{ github.workspace }}/${{ steps.sign_lemmy_redirect.outputs.signedReleaseFile }}
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
replacesArtifacts: false
omitBodyDuringUpdate: true
tag: ${{ steps.release.outputs.tag_name }}
- name: Add Mastodon Redirect to Release
uses: ncipollo/release-action@v1
with:
artifacts: ${{ github.workspace }}/${{ steps.sign_mastodon_redirect.outputs.signedReleaseFile }}
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
replacesArtifacts: false
omitBodyDuringUpdate: true
tag: ${{ steps.release.outputs.tag_name }}