Skip to content

CI

CI #2816

Workflow file for this run

name: CI
on:
pull_request:
paths-ignore:
- '.idea/**'
- '.github/ISSUE_TEMPLATE/**'
- '.gitattributes'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'custom-game-area/**'
- 'wiki/**'
push:
branches:
- master
paths-ignore:
- '.idea/**'
- '.github/**'
- '.gitattributes'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'renovate.json'
- 'custom-game-area/**'
- 'FUNDING.yml'
- 'wiki/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
JAVA_VERSION: 17
JAVA_DISTRO: 'temurin'
VERSION_CODE: '${{ github.run_number }}'
jobs:
build:
runs-on: macos-14
if: github.ref != 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
cache: 'gradle'
- name: Determine Version Name
shell: bash
run: |
VERSION_NAME=$VERSION_CODE
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@v4
with:
name: apk
path: app/build/outputs/apk/ci/app-ci.apk
- name: Upload De-obfuscation mapping file
uses: actions/upload-artifact@v4
with:
name: mapping-ci
path: app/build/outputs/mapping/ci/mapping.txt
play_store:
runs-on: macos-14
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
cache: 'gradle'
- name: Determine Version Name
shell: bash
run: |
VERSION_NAME=$VERSION_CODE
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
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Deploy to Play Store
uses: maierj/[email protected]
with:
lane: 'deploy'
env:
SUPPLY_JSON_KEY_DATA: ${{ secrets.SERVICE_ACCOUNT_NEW_APP }}
KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}
- name: Upload Bundle
uses: actions/upload-artifact@v4
with:
name: bundle
path: app/build/outputs/bundle/release/app-release.aab
if: ${{ !cancelled() }}
- name: Upload De-obfuscation mapping file
uses: actions/upload-artifact@v4
with:
name: mapping-release
path: app/build/outputs/mapping/release/mapping.txt
if: ${{ !cancelled() }}
# Release master branch
github_release:
needs: play_store
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Download Universal APK
uses: maierj/[email protected]
with:
lane: 'download_apk'
options: '{ "version_code": "$VERSION_CODE" }'
env:
SUPPLY_JSON_KEY_DATA: ${{ secrets.SERVICE_ACCOUNT_NEW_APP }}
- name: zip APK
run: zip FGA-apk-${VERSION_CODE}.zip *.apk
- name: Create tag
uses: mathieudutour/[email protected]
with:
custom_tag: ${{ env.VERSION_CODE }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
uses: ncipollo/[email protected]
with:
generateReleaseNotes: true
artifacts: 'FGA-apk-${{ env.VERSION_CODE }}.zip'
tag: 'v${{ env.VERSION_CODE }}'
name: 'FGA ${{ env.VERSION_CODE }}'
prerelease: true