Fix gradle/android/java version requirement #34
Workflow file for this run
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: [ci] | |
permissions: {} | |
env: | |
API_DOMAIN: eternagame.org | |
NODE_VERSION: 20.x | |
BUILD_TYPE: prod | |
jobs: | |
build-eternajs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
persist-credentials: false | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('./eternajs/package-lock.json') }} | |
- name: Create GitHub App token for built engine access | |
uses: actions/create-github-app-token@v1 | |
id: engines-app-token | |
with: | |
app-id: ${{ secrets.BUILT_ENGINE_CLIENT_ID }} | |
private-key: ${{ secrets.BUILT_ENGINE_APP_PRIVATE_KEY }} | |
owner: eternagame | |
repositories: eternajs-folding-engines | |
- name: Set GitHub App token authentication for built engine access | |
run: git config --global url.https://x-access-token:${{ steps.engines-app-token.outputs.token }}@github.com/eternagame/eternajs-folding-engines.insteadOf ssh://[email protected]/eternagame/eternajs-folding-engines | |
working-directory: ./eternajs | |
- name: Install dependencies | |
run: npm ci | |
working-directory: ./eternajs | |
- name: Build | |
run: npm run build:${{ env.BUILD_TYPE }} | |
working-directory: ./eternajs | |
env: | |
APP_SERVER_URL: https://${{ env.API_DOMAIN }} | |
MOBILE_APP: true | |
DEBUG: false | |
ENGINE_LOCATION: package | |
# Due to licensed components, we don't want the intermediate build of EternaJS available for download | |
- name: Encrypt build | |
run: gpgtar --encrypt --output eternajs --symmetric --gpg-args "--passphrase ${{ secrets.ARTIFACT_ENCRYPTION_KEY }} --batch" * | |
working-directory: ./eternajs/dist/prod | |
- name: Upload build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: eternajs | |
path: ./eternajs/dist/prod/eternajs | |
build-wrapper: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('./package-lock.json') }} | |
- name: Install dependencies | |
run: npm ci --ignore-scripts | |
- name: Build | |
run: npm run build:${{ env.BUILD_TYPE }} | |
env: | |
PARALLEL_BUILD: true | |
APP_SERVER_URL: https://${{ env.API_DOMAIN }} | |
INJECT_COOKIE_DOMAIN: .${{ env.API_DOMAIN }} | |
- name: Upload build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wrapper | |
path: ./www | |
build-app: | |
needs: [build-eternajs, build-wrapper] | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- runner: macos-latest | |
target: ios | |
- runner: ubuntu-latest | |
target: android | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: wrapper | |
path: ./www | |
- uses: actions/download-artifact@v4 | |
with: | |
name: eternajs | |
path: ./www | |
- name: Decrypt eternajs artifact | |
run: | | |
gpgtar --decrypt --gpg-args "--passphrase ${{ secrets.ARTIFACT_ENCRYPTION_KEY }} --batch" eternajs | |
rm eternajs | |
mv eternajs_1_ eternajs | |
working-directory: ./www | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('./eternajs/package-lock.json') }} | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Install dependencies | |
run: npm ci --ignore-scripts | |
- name: Setup cordova platform | |
run: npx cordova platform add ${{ matrix.target }} | |
env: | |
PARALLEL_BUILD: true | |
- name: Build | |
if: ${{ matrix.target == 'android' }} | |
run: npx cordova build ${{ matrix.target }} --${{ env.BUILD_TYPE == 'prod' && 'release' || 'debug' }} --device | |
env: | |
PARALLEL_BUILD: true | |
JAVA_HOME: env.JAVA_HOME_17_X64 | |
- name: Build | |
if: ${{ matrix.target == 'ios' }} | |
run: npx cordova build ${{ matrix.target }} --${{ env.BUILD_TYPE == 'prod' && 'release' || 'debug' }} --device | |
env: | |
PARALLEL_BUILD: true |