Skip to content

CI

CI #2039

Workflow file for this run

name: CI
on:
pull_request:
paths-ignore:
- '.idea/**'
- '.github/ISSUE_TEMPLATE/**'
- '.gitattributes'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'custom-game-area/**'
push:
branches:
- master
tags:
- 'v*'
paths-ignore:
- '.idea/**'
- '.github/**'
- '.gitattributes'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'renovate.json'
- 'custom-game-area/**'
workflow_dispatch:
inputs:
release-canary:
description: 'Release canary or not'
default: 'true'
required: true
release-playstore:
description: 'Release play store version or not'
default: 'true'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Determine Version Name
shell: bash
run: |
VERSION_CODE=${{ github.run_number }}
VERSION_NAME=${{ github.run_number }}
if [[ ${{ github.ref }} == refs/tags/* ]]; then
VERSION_NAME = ${{ github.ref_name }}
fi
echo "FGA_VERSION_CODE=$VERSION_CODE" >>${GITHUB_ENV}
echo "FGA_VERSION_NAME=$VERSION_NAME" >>${GITHUB_ENV}
- name: Build Android Package
run: ./gradlew assembleCi --scan --parallel --no-daemon
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: apk
path: app/build/outputs/apk/ci/app-ci.apk
- name: Upload De-obfuscation mapping file
uses: actions/upload-artifact@v3
with:
name: mapping
path: app/build/outputs/mapping/ci/mapping.txt
# Release master branch
canary:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && inputs.release-canary
steps:
- uses: actions/download-artifact@v3
with:
name: apk
- name: Rename apk
run: mv app-ci.apk io.github.fate_grand_automata.apk
- id: create_release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "canary"
prerelease: true
title: 'FGA canary-${{ github.run_number }}'
files: |
*.apk
play_store:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && inputs.release-playstore
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Determine Version Name
shell: bash
run: |
VERSION_CODE=${{ github.run_number }}
VERSION_NAME=${{ github.run_number }}
if [[ ${{ github.ref }} == refs/tags/* ]]; then
VERSION_NAME = ${{ github.ref_name }}
fi
echo "FGA_VERSION_CODE=$VERSION_CODE" >>${GITHUB_ENV}
echo "FGA_VERSION_NAME=$VERSION_NAME" >>${GITHUB_ENV}
- name: Decrypt keystore (GPG)
env:
GPG_KEYSTORE: ${{ secrets.GPG_KEYSTORE }}
working-directory: ./app
run: gpg --quiet --batch --yes --decrypt --passphrase="$GPG_KEYSTORE" --output fgautomata.keystore fgautomata.keystore.gpg
- name: Build Bundle
env:
KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}
run: ./gradlew bundleRelease
- name: Upload Bundle
uses: actions/upload-artifact@v3
with:
name: bundle
path: app/build/outputs/bundle/release/app-release.aab
- name: Download mapping file
uses: actions/download-artifact@v3
with:
name: mapping
- name: Deploy to Play Store
uses: r0adkll/upload-google-play@v1
with:
track: beta
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT }}
packageName: io.github.fate_grand_automata
releaseFiles: app/build/outputs/bundle/release/app-release.aab
mappingFile: ./mapping.txt