Fix name, version and arch mis match on strings #34
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 \ | |
--build-cache \ | |
-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 }}" \ | |
-Pandroid.enableProguardInReleaseBuilds=true | |
- name: Rename APK | |
shell: bash | |
run: | | |
cd android/app/build/outputs/apk/release | |
tag=${{ steps.tag.outputs.tag }} | |
for file in app-*.apk; do name=$(echo $file | cut -d'-' -f2-3); new_name="prevanced-manager-${name%-release*}-$tag.apk"; mv "$file" "$new_name"; done | |
- 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' | |
continue-on-error: true | |
run: | | |
tag=${{ steps.tag.outputs.tag }} | |
cd $GITHUB_WORKSPACE | |
git checkout main | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
sed -i "s/\"version\": \".*\"/\"version\": \"${tag:1}\"/g" app.json | |
git add app.json | |
git commit -m "chore: bump version to $tag" | |
git push origin main |