Continuous Integration #725
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}"}' |