forked from connectbot/connectbot
-
Notifications
You must be signed in to change notification settings - Fork 2
136 lines (116 loc) · 4.12 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
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-latest
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@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Cache Gradle Home files
uses: actions/cache@v3
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: |
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
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
- name: Store artifacts for upload
if: ${{ github.event_name == 'push' }}
uses: actions/upload-artifact@v3
with:
name: apk
path: |
release-title.txt
tag.txt
ConnectBot-git-*-unsigned.apk
ConnectBot-git-*-unsigned.aab
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@v3
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@v1
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-git-*-unsigned.apk
ConnectBot-git-*-unsigned.aab
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@v3
with:
name: apk
- name: Set release name
id: name
run: |
echo "GITHUB_TAG=$(cat tag.txt)" >> "$GITHUB_OUTPUT"
- name: Call remote signer
uses: joelwmale/webhook-action@ee20d8c79e728c2d339b114fd27772ee0226aa41
with:
url: ${{ secrets.SIGNER_WEBHOOK_URL }}
body: '{"TAG_ID": "${{ steps.name.outputs.GITHUB_TAG }}"}'