Upgrade dependencies #194
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: CI | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*.*.*' | |
pull_request: | |
concurrency: | |
group: build-${{ github.event.pull_request.number || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build project | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@v2 | |
- name: Copy CI gradle.properties | |
run: | | |
mkdir -p ~/.gradle | |
cp .github/ci-gradle.properties ~/.gradle/gradle.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: Set up JDK | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 17 | |
distribution: adopt | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Build APK | |
run: ./gradlew spotlessCheck assembleRelease --stacktrace | |
- name: Sign APK | |
if: github.repository == 'ivaniskandar/shouko' && github.event_name == 'push' | |
uses: r0adkll/sign-android-release@v1 | |
id: sign_app | |
with: | |
releaseDirectory: app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
env: | |
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }} | |
- name: Upload APK | |
if: "!startsWith(github.ref, 'refs/tags/') && github.repository == 'ivaniskandar/shouko' && github.event_name == 'push'" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: shouko-canary | |
path: ${{ steps.sign_app.outputs.signedReleaseFile }} | |
# Create new release | |
- name: Get tag name | |
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'ivaniskandar/shouko' | |
id: get_tag_name | |
run: | | |
set -x | |
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
- name: Rename artifact | |
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'ivaniskandar/shouko' | |
run: cp ${{ env.SIGNED_RELEASE_FILE }} shouko-${{ env.VERSION_TAG }}.apk | |
- name: Create Release | |
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'ivaniskandar/shouko' | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.VERSION_TAG }} | |
name: ${{ env.VERSION_TAG }} | |
files: shouko-${{ env.VERSION_TAG }}.apk | |
draft: true | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |