Skip to content

Increase version

Increase version #104

Workflow file for this run

name: Build APP
on:
push:
tags:
- v*
workflow_dispatch:
jobs:
build:
name: Build APK
runs-on: ubuntu-latest
strategy:
matrix:
task:
- assembleNsfwDisabledNoKeyDozeEnabledBillingDisabled
- assembleNsfwEnabledNoKeyDozeEnabledBillingDisabled
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract directory
id: extract_name
uses: actions/github-script@v7
with:
result-encoding: string
script: |
return '${{ matrix.task }}'.replace('assembleN', 'n');
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Set up API keys
run: |
echo "prod_api_key=0000000000" >> local.properties
echo "dev_api_key=0000000000" >> local.properties
echo "support_email=${{ secrets.SUPPORT_EMAIL }}" >> local.properties
echo "examples_url=${{ secrets.EXAMPLES_URL }}" >> local.properties
echo "weather_api_key=${{ secrets.WEATHER_API_KEY }}" >> local.properties
- name: Setup build tool version variable
shell: bash
run: |
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
echo Last build tool version is: $BUILD_TOOL_VERSION
- name: Build with Gradle
run: ./gradlew ${{ matrix.task }}
- name: Sign Android release
uses: r0adkll/sign-android-release@v1
id: sign_app
with:
releaseDirectory: app/build/outputs/apk/${{ steps.extract_name.outputs.result }}/release/
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.extract_name.outputs.result }}
path: ${{ steps.sign_app.outputs.signedReleaseFile }}
if-no-files-found: error
retention-days: 1
create_release:
name: Create a release
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push'
permissions:
contents: write
steps:
- name: Extract version name
id: extract_name
uses: actions/github-script@v7
with:
result-encoding: string
script: |
return context.payload.ref.replace(/refs\/tags\/v/, '');
- name: Download SFW
uses: actions/download-artifact@v4
with:
name: nsfwDisabledNoKeyDozeEnabledBillingDisabled
path: sfw
- name: Download NSFW
uses: actions/download-artifact@v4
with:
name: nsfwEnabledNoKeyDozeEnabledBillingDisabled
path: nsfw
- name: Rename files
run: |
mv sfw/*.apk cz.chrastecky.aiwallpaperchanger_${{ steps.extract_name.outputs.result }}_SFW.apk
mv nsfw/*.apk cz.chrastecky.aiwallpaperchanger_${{ steps.extract_name.outputs.result }}_NSFW.apk
- name: Create a release
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release ${{ steps.extract_name.outputs.result }}
draft: false
prerelease: false
fail_on_unmatched_files: true
generate_release_notes: true
make_latest: true
files: |
cz.chrastecky.aiwallpaperchanger_${{ steps.extract_name.outputs.result }}_SFW.apk
cz.chrastecky.aiwallpaperchanger_${{ steps.extract_name.outputs.result }}_NSFW.apk