forked from connectbot/connectbot
-
Notifications
You must be signed in to change notification settings - Fork 2
153 lines (131 loc) · 4.96 KB
/
ci.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
name: Continuous Integration
on:
push:
branches: [ main ]
tags:
- "v*.*.*"
pull_request:
branches: [ main ]
schedule:
- cron: "0 7 */3 * *"
merge_group:
types: [ checks_requested ]
jobs:
build:
name: Build and test
runs-on: macos-13 # emulator never starts on macOS 14 https://github.com/ReactiveCircus/android-emulator-runner/issues/392#issuecomment-2106167725
steps:
- name: Checkout (with history)
if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Checkout (without history)
if: ${{ github.event_name != 'push' }}
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Cache Gradle Home files
uses: actions/cache@v4
continue-on-error: true
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-home-examples-${{ hashFiles('**/*.gradle') }}
- name: Build ConnectBot
run: ./gradlew build bundleGoogleRelease
- name: Run instrument tests
uses: reactivecircus/[email protected]
with:
api-level: 28
target: default
arch: x86_64
profile: Nexus 4
script: ./gradlew connectedCheck --continue
- name: Prepare release
if: ${{ github.event_name == 'push' }}
run: |
if git describe --exact-match; then \
TAGGED=yes
fi
if [[ -n $TAGGED ]]; then
GITHUB_TAG="$(git describe)"
echo "${GITHUB_TAG}" > tag.txt
echo "Release ${GITHUB_TAG}" > release-title.txt
else \
GITHUB_TAG="git-$(git describe)"
GITHUB_TITLE="$(git log -1 --pretty=%B | head -1)"
echo "${GITHUB_TAG}" > tag.txt
echo "${GITHUB_TAG}: ${GITHUB_TITLE}" > release-title.txt
fi
cp ./app/build/outputs/apk/oss/release/app-oss-release-unsigned.apk ConnectBot-${GITHUB_TAG}-oss-unsigned.apk
cp ./app/build/outputs/apk/google/release/app-google-release-unsigned.apk ConnectBot-${GITHUB_TAG}-google-unsigned.apk
cp ./app/build/outputs/bundle/googleRelease/app-google-release.aab ConnectBot-${GITHUB_TAG}-google-unsigned.aab
cp ./app/build/outputs/native-debug-symbols/googleRelease/native-debug-symbols.zip ConnectBot-${GITHUB_TAG}-google.native-debug-symbols.zip
cp ./app/build/outputs/native-debug-symbols/ossRelease/native-debug-symbols.zip ConnectBot-${GITHUB_TAG}-oss.native-debug-symbols.zip
- name: Store artifacts for upload
if: ${{ github.event_name == 'push' }}
uses: actions/upload-artifact@v4
with:
name: apk
path: |
release-title.txt
tag.txt
ConnectBot-*-unsigned.apk
ConnectBot-*-unsigned.aab
ConnectBot-*.native-debug-symbols.zip
upload:
name: Upload to GitHub releases
needs: build
if: ${{ (github.event_name == 'push') && (github.repository == 'connectbot/connectbot') && ((github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/tags/v')) }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts from previous job
uses: actions/download-artifact@v4
with:
name: apk
- name: Set release name
id: name
run: |
echo "RELEASE_TITLE=$(cat release-title.txt)" >> "$GITHUB_OUTPUT"
echo "GITHUB_TAG=$(cat tag.txt)" >> "$GITHUB_OUTPUT"
- name: Upload release
uses: softprops/action-gh-release@v2
with:
body: "Untested build"
draft: true
tag_name: ${{ steps.name.outputs.GITHUB_TAG }}
name: ${{ steps.name.outputs.RELEASE_TITLE }}
generate_release_notes: true
files: |
ConnectBot-*-unsigned.apk
ConnectBot-*-unsigned.aab
ConnectBot-*.native-debug-symbols.zip
signing:
name: Trigger remote signing
needs: upload
if: ${{ (github.event_name == 'push') && (github.repository == 'connectbot/connectbot') && ((github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/tags/v')) }}
runs-on: ubuntu-latest
steps:
- name: Download artifacts from previous job
uses: actions/download-artifact@v4
with:
name: apk
- name: Set release name
id: name
run: |
echo "GITHUB_TAG=$(cat tag.txt)" >> "$GITHUB_OUTPUT"
- name: Call remote signer
uses: distributhor/[email protected]
with:
webhook_url: ${{ secrets.SIGNER_WEBHOOK_URL }}
data: '{"tag_id": "${{ steps.name.outputs.GITHUB_TAG }}"}'