2021-09-12 10:01:06 +02:00
|
|
|
name: Android CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- '*'
|
|
|
|
- '!l10n_dev'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
2021-09-12 10:20:00 +02:00
|
|
|
if: ${{ false }}
|
2021-09-12 10:01:06 +02:00
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 100
|
|
|
|
|
|
|
|
- name: Fetch all tags
|
|
|
|
run: git fetch origin +refs/tags/*:refs/tags/*
|
|
|
|
|
|
|
|
- name: Set up JDK 11
|
|
|
|
uses: actions/setup-java@v2
|
|
|
|
with:
|
|
|
|
java-version: '11'
|
|
|
|
java-package: jdk
|
|
|
|
distribution: 'adopt'
|
|
|
|
cache: gradle
|
|
|
|
|
|
|
|
- name: Validate gradle wrapper
|
|
|
|
uses: gradle/wrapper-validation-action@v1
|
|
|
|
|
|
|
|
- name: Decrypt secret
|
|
|
|
run: |
|
|
|
|
gpg -d --passphrase "${{ secrets.FROST_TAR_SECRET }}" --batch "files/frost_github.tar.gpg" > "files/frost_github.tar"
|
|
|
|
tar xvf files/frost_github.tar -C files
|
|
|
|
|
|
|
|
- name: Checkout Gradle Build Cache
|
|
|
|
if: ${{ steps.self_hosted.outputs.FLAG != 'self-hosted' }}
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.gradle/caches
|
|
|
|
~/.gradle/wrapper
|
|
|
|
!~/.gradle/wrapper/dists/**/gradle*.zip
|
|
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
|
|
|
|
restore-keys: |
|
|
|
|
gradle-${{ runner.os }}-
|
|
|
|
|
|
|
|
- name: Grant execute permission for gradlew
|
|
|
|
run: chmod +x gradlew
|
|
|
|
|
|
|
|
- name: Android Git Version
|
|
|
|
run: ./gradlew --quiet androidGitVersion
|
|
|
|
|
|
|
|
- name: Check and Test
|
|
|
|
run: ./gradlew spotlessCheck lintReleaseTest testReleaseUnitTest
|
|
|
|
|
|
|
|
- name: Assemble
|
|
|
|
run: ./gradlew assembleReleaseTest
|
|
|
|
|
|
|
|
- name: Upload Test APK
|
|
|
|
uses: actions/upload-artifact@v2.2.4
|
|
|
|
with:
|
|
|
|
name: Frost-releaseTest.apk
|
|
|
|
path: app/build/outputs/apk/releaseTest/Frost-releaseTest.apk
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
# Tests artifact upload
|
|
|
|
build-test:
|
|
|
|
|
2021-09-12 10:20:00 +02:00
|
|
|
# if: ${{ false }}
|
2021-09-12 10:01:06 +02:00
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Create
|
|
|
|
run: |
|
|
|
|
mkdir apk
|
|
|
|
echo "apk test" > apk/Frost-releaseTest.apk
|
|
|
|
|
|
|
|
- name: Upload Test APK
|
|
|
|
uses: actions/upload-artifact@v2.2.4
|
|
|
|
with:
|
|
|
|
name: Frost-releaseTest.apk
|
|
|
|
path: apk/Frost-releaseTest.apk
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
release-test:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2021-09-12 10:20:00 +02:00
|
|
|
needs: build-test
|
2021-09-12 10:01:06 +02:00
|
|
|
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.TEST_RELEASE_GITHUB_API_TOKEN }}
|
|
|
|
OWNER: AllanWang
|
|
|
|
REPO: Frost-for-Facebook-APK-Builder
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: "${{ env.OWNER }}/${{ env.REPO }}"
|
|
|
|
token: ${{ env.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
# Contiguous to release IDs from Travis builds
|
|
|
|
- name: Current Version
|
|
|
|
run: |
|
|
|
|
CURR_ID=$(( ${{ github.run_number }} + 2914 ))
|
|
|
|
echo "RELEASE_ID_NUMBER=${CURR_ID}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Should Release
|
|
|
|
run: |
|
|
|
|
PREV_ID=$(cat Frost.txt | grep -o -E '[0-9]'+)
|
2021-09-12 10:20:00 +02:00
|
|
|
SHOULD_RELEASE=$( if [[ ${{ env.RELEASE_ID_NUMBER }} -gt $PREV_ID ]]; then echo true; else echo false; fi )
|
2021-09-12 10:01:06 +02:00
|
|
|
echo "Prev $PREV_ID Now ${{ env.RELEASE_ID_NUMBER }} Should Release $SHOULD_RELEASE"
|
|
|
|
echo "SHOULD_RELEASE=${SHOULD_RELEASE}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Update File
|
2021-09-12 10:20:00 +02:00
|
|
|
if: ${{ env.SHOULD_RELEASE == 'true' }}
|
2021-09-12 10:01:06 +02:00
|
|
|
run: echo "Frost v${{ env.RELEASE_ID_NUMBER }}" > Frost.txt
|
|
|
|
|
|
|
|
- name: Create Commit
|
2021-09-12 10:20:00 +02:00
|
|
|
if: ${{ env.SHOULD_RELEASE == 'true' }}
|
2021-09-12 10:01:06 +02:00
|
|
|
id: create_commit
|
|
|
|
uses: EndBug/add-and-commit@v7
|
|
|
|
with:
|
|
|
|
message: 'Github Action ${{ env.RELEASE_ID_NUMBER }} [skip ci]'
|
|
|
|
tag: 'v${{ env.RELEASE_ID_NUMBER }}'
|
|
|
|
author_name: Pitched Apps CI
|
|
|
|
author_email: pitchedapps@gmail.com
|
|
|
|
branch: master
|
|
|
|
push: true
|
|
|
|
|
|
|
|
# After commit
|
|
|
|
- name: Download APK
|
2021-09-12 10:20:00 +02:00
|
|
|
if: ${{ env.SHOULD_RELEASE == 'true' }}
|
2021-09-12 10:01:06 +02:00
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: Frost-releaseTest.apk
|
|
|
|
|
|
|
|
- name: Rename APK
|
2021-09-12 10:20:00 +02:00
|
|
|
if: ${{ env.SHOULD_RELEASE == 'true' }}
|
2021-09-12 10:01:06 +02:00
|
|
|
run: |
|
|
|
|
mv Frost-releaseTest.apk Frost-releaseTest-v${{ env.RELEASE_ID_NUMBER }}.apk
|
|
|
|
ls -l
|
|
|
|
|
|
|
|
- name: Create Release
|
2021-09-12 10:20:00 +02:00
|
|
|
if: ${{ (env.SHOULD_RELEASE == 'true') && steps.create_commit.outputs.pushed }}
|
2021-09-12 10:01:06 +02:00
|
|
|
uses: ncipollo/release-action@v1
|
|
|
|
with:
|
|
|
|
token: ${{ env.GITHUB_TOKEN }}
|
|
|
|
owner: ${{ env.OWNER }}
|
|
|
|
repo: ${{ env.REPO }}
|
|
|
|
artifactErrorsFailBuild: true
|
|
|
|
artifacts: "Frost-releaseTest-v${{ env.RELEASE_ID_NUMBER }}.apk"
|
|
|
|
artifactContentType: "application/zip"
|
|
|
|
body: |
|
|
|
|
Automatic Release v${{ env.RELEASE_ID_NUMBER }} for branch `${{ github.ref }}`
|
|
|
|
https://github.com/${{ github.repository }}/commit/${{ github.sha }}
|
|
|
|
tag: 'v${{ env.RELEASE_ID_NUMBER }}'
|
|
|
|
allowUpdates: false
|
|
|
|
|
|
|
|
- name: Echo Result
|
2021-09-12 10:20:00 +02:00
|
|
|
if: ${{ env.SHOULD_RELEASE == 'true' }}
|
2021-09-12 10:01:06 +02:00
|
|
|
run: echo "Created release at https://github.com/${{ env.OWNER }}/${{ env.REPO }}/releases/tag/v${{ env.RELEASE_ID_NUMBER }}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|