Skip to content

Commit

Permalink
ci: split out nightly build ci configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiredPlanck committed Jan 21, 2024
1 parent 154b053 commit 21f2775
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 20 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/nightly-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Nightly
on:
workflow_dispatch:
schedule:
- cron: '40 9 * * *' # UTC 3:00 daily

env:
CI_NAME: Nightly CI
jobs:
build:
if: ${{ github.repository == 'WhiredPlanck/trime-new' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 21
# will restore cache of dependencies and wrappers
cache: 'gradle'

- name: Calculate JNI cache hash
id: cache-hash
run: |
./gradlew :app:calculateNativeCacheHash
- name: Fetch JNI cache
uses: actions/cache@v3
id: jni-cache
with:
path: "app/prebuilt"
key: ${{ runner.os }}-trime-jni-release-${{ steps.cache-hash.outputs.native-cache-hash }}

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Setup keystore
run: |
echo ${{ secrets.SIGNING_KEY }} | base64 --decode | cat >> $(pwd)/signingkey.jks
cat << EOF > keystore.properties
storeFile=$(pwd)/signingkey.jks
storePassword=${{ secrets.KEY_STORE_PASSWORD }}
keyAlias=${{ secrets.ALIAS }}
keyPassword=${{ secrets.KEY_PASSWORD }}
EOF
- name: Build Trime
run: make release

- name: Add JNI cache
if: ${{ !steps.jni-cache.outputs.cache-hit }}
run: cp -R app/build/intermediates/stripped_native_libs/release/out/lib app/prebuilt

- name: Create Nightly release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
prerelease: true
artifacts: "app/build/outputs/apk/release/*.apk"
removeArtifacts: true
name: "Nightly Build"
token: ${{ secrets.GITHUB_TOKEN }}
20 changes: 0 additions & 20 deletions .github/workflows/release-ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Release
on:
push:
branches:
- develop
tags:
- '*'
env:
Expand All @@ -17,12 +15,6 @@ jobs:
submodules: recursive
fetch-depth: 0

- name: Get branch name
id: vars
run: |
echo ${GITHUB_REF#refs/*/}
echo CI_BRANCH=${GITHUB_REF#refs/*/} >> $GITHUB_ENV
- name: Setup Java
uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -76,18 +68,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Nightly release
if: ${{ github.repository == 'osfans/trime' || github.ref == 'refs/heads/develop' }}
uses: ncipollo/release-action@v1
with:
allowUpdates: true
prerelease: true
artifacts: "app/build/outputs/apk/release/*.apk"
removeArtifacts: true
name: "Nightly Build"
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}

- name: Create Stable release
if: ${{ github.ref != 'refs/heads/develop' }}
uses: ncipollo/release-action@v1
Expand Down

0 comments on commit 21f2775

Please sign in to comment.