Refactor config.tsx file #27
Workflow file for this run
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: Build & Publish Release APK | |
on: | |
push: | |
branches: | |
- stable | |
tags: | |
- "*" | |
workflow_dispatch: | |
jobs: | |
Gradle: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "adopt" | |
java-version: "20" | |
cache: "gradle" | |
- name: Setup Bun | |
uses: antongolub/action-setup-bun@v1 | |
with: | |
bun-version: "1.0.25" | |
cache: true | |
cache-bin: true | |
- name: Prepare Tag | |
shell: bash | |
id: tag | |
run: | | |
if [[ ${{ github.ref_name }} == v* ]]; then | |
tag="${{ github.ref_name }}" | |
echo "prerelease=false" >> $GITHUB_OUTPUT | |
elif [[ ${{ github.ref_name }} == stable ]]; then | |
# check previous tag if available increment it | |
previous_tag=$(git describe --tags --abbrev=0) | |
if [[ $previous_tag == v* ]]; then | |
previous_tag=${previous_tag:1} | |
IFS='.' read -r -a array <<< "$previous_tag" | |
array[3]=$((array[2]+1)) | |
tag="v${array[0]}.${array[1]}.${array[2]}" | |
else | |
tag="v0.0.1" | |
fi | |
echo "prerelease=false" >> $GITHUB_OUTPUT | |
else | |
tag="$(date +'vdev.%y.%m.%d.%H%M%S')" | |
echo "prerelease=true" >> $GITHUB_OUTPUT | |
fi | |
echo "tag=$tag" >> $GITHUB_OUTPUT | |
- name: Bump version in app.json | |
run: | | |
tag=${{ steps.tag.outputs.tag }} | |
# change version in app.json | |
sed -i "s/\"version\": \".*\"/\"version\": \"${tag:1}\"/g" app.json | |
- name: Install dependencies | |
run: bun install | |
- name: Build Expo | |
run: bun run build:android | |
- name: Build Signed APK | |
run: | | |
cd android | |
chmod +x ./gradlew | |
./gradlew assembleRelease \ | |
-Pandroid.injected.signing.store.file=$GITHUB_WORKSPACE/android/app/keystore.jks \ | |
-Pandroid.injected.signing.store.password="${{ secrets.STORE_PASSWORD }}" \ | |
-Pandroid.injected.signing.key.alias="key0" \ | |
-Pandroid.injected.signing.key.password="${{ secrets.KEY_PASSWORD }}" | |
- name: Rename APK | |
shell: bash | |
run: | | |
mv android/app/build/outputs/apk/release/app-release.apk android/app/build/outputs/apk/release/prevanced-manager-${{ steps.tag.outputs.tag }}.apk | |
- name: Release APK | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: android/app/build/outputs/apk/release/*.apk | |
tag: ${{ steps.tag.outputs.tag }} | |
prerelease: ${{ steps.tag.outputs.prerelease }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Sync app.json version | |
if: steps.tag.outputs.prerelease == 'false' | |
run: | | |
tag=${{ steps.tag.outputs.tag }} | |
if [[ $(git status --porcelain) ]]; then | |
git add app.json | |
git commit -m "chore: bump version to $tag" | |
git push |