Skip to content

Commit 97ad0c3

Browse files
committed
Add CI
1 parent 8a93e39 commit 97ad0c3

File tree

2 files changed

+119
-0
lines changed

2 files changed

+119
-0
lines changed

.github/workflows/ci.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- dev
8+
- main
9+
paths-ignore:
10+
- 'README.md'
11+
- 'doc/**'
12+
- 'fastlane/**'
13+
- 'assets/**'
14+
- '.github/**/*.md'
15+
- '.github/FUNDING.yml'
16+
- '.github/ISSUE_TEMPLATE/**'
17+
push:
18+
branches:
19+
- dev
20+
- main
21+
paths-ignore:
22+
- 'README.md'
23+
- 'doc/**'
24+
- 'fastlane/**'
25+
- 'assets/**'
26+
- '.github/**/*.md'
27+
- '.github/FUNDING.yml'
28+
- '.github/ISSUE_TEMPLATE/**'
29+
30+
jobs:
31+
build:
32+
runs-on: ubuntu-latest
33+
34+
permissions: write-all
35+
36+
steps:
37+
- name: Checkout branch "${{ github.ref_name }}"
38+
run: |
39+
git clone --no-checkout https://github.com/MaintainTeam/WhatsDeleted.git .
40+
git config core.symlinks false
41+
git checkout --progress --force ${{ github.ref_name }}
42+
43+
- name: Set up JDK 17
44+
uses: actions/setup-java@v4
45+
with:
46+
java-version: 17
47+
distribution: "temurin"
48+
cache: 'gradle'
49+
50+
- name: Build debug APK and run jvm tests
51+
run: ./gradlew assembleDebug lintDebug testDebugUnitTest --stacktrace -DskipFormatKtlint
52+
53+
- name: Upload APK
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: app
57+
path: app/build/outputs/apk/debug/*.apk

.github/workflows/release.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
title:
7+
type: string
8+
description: 'Title'
9+
required: true
10+
default: 'v0.00.0 R0'
11+
is_pre_release:
12+
type: boolean
13+
description: 'Set as a pre-release'
14+
required: true
15+
default: true
16+
17+
jobs:
18+
build-and-release:
19+
runs-on: ubuntu-latest
20+
21+
permissions: write-all
22+
23+
steps:
24+
- name: Checkout branch "${{ github.ref_name }}"
25+
run: |
26+
git clone --no-checkout https://github.com/MaintainTeam/WhatsDeleted.git .
27+
git config core.symlinks false
28+
git checkout --progress --force ${{ github.ref_name }}
29+
30+
- name: Set up JDK 17
31+
uses: actions/setup-java@v4
32+
with:
33+
java-version: 17
34+
distribution: "temurin"
35+
cache: 'gradle'
36+
37+
- name: Build release APK
38+
run: ./gradlew assembleRelease
39+
40+
- name: Sign APK
41+
env:
42+
KEYSTORE: ${{ secrets.KEYSTORE }}
43+
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
44+
run: |
45+
version=$( grep "versionName" app/build.gradle | awk -F'"' '{print $2}' )
46+
echo "${KEYSTORE}" | base64 -d > apksign.keystore
47+
${ANDROID_HOME}/build-tools/34.0.0/apksigner sign --ks apksign.keystore --ks-pass env:SIGNING_STORE_PASSWORD "app/build/outputs/apk/release/app-release-unsigned.apk"
48+
mv app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/"whatsdeleted_v${version}.apk"
49+
50+
- name: Create release and upload
51+
run: |
52+
version=$( grep "versionName" app/build.gradle | awk -F'"' '{print $2}' )
53+
gh auth login --with-token <<<"${{ secrets.GITHUB_TOKEN }}"
54+
gh release create "v${version}" --title "${{ inputs.title }}" --notes-file ".github/changelog.md" --prerelease=${{ inputs.is_pre_release }} --repo MaintainTeam/WhatsDeleted
55+
gh release upload "v${version}" app/build/outputs/apk/release/*.apk --repo MaintainTeam/WhatsDeleted
56+
57+
- name: Archive reports for job
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: reports
61+
path: '*/build/reports'
62+
if: ${{ always() }}

0 commit comments

Comments
 (0)