Tidying up Gradle #104
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 | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 21 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Set environments | |
run: | | |
{ | |
echo "version=v$(grep -oP 'versionName\s*=\s*\"\K[^\"]+' app/build.gradle.kts)" | |
echo "commit=$(echo ${{ github.sha }} | cut -c-7)" | |
echo "repo=$(echo ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/})" | |
} >> $GITHUB_ENV | |
- name: Build | |
run: | | |
if [ "${{ secrets.STORE_FILE }}" != "" ]; then | |
echo "${{ secrets.STORE_FILE }}" | base64 -d > app/release.jks | |
export STORE_PASSWORD="${{ secrets.STORE_PASSWORD }}" | |
export KEY_ALIAS="${{ secrets.KEY_ALIAS }}" | |
export KEY_PASSWORD="${{ secrets.KEY_PASSWORD }}" | |
fi | |
./gradlew assemble --no-daemon --stacktrace --warning-mode=all | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.repo }}(${{ env.version }}@${{ env.commit }}) | |
path: app/build/outputs/apk/**/app-*.apk |