Skip to content

Adapts plugin structure to new Android v2, adds working permission flow #58

Adapts plugin structure to new Android v2, adds working permission flow

Adapts plugin structure to new Android v2, adds working permission flow #58

Workflow file for this run

# Workflow to automatically compile a Android library on commit/push
name: Build on push
# Controls when the action will run. Triggers the workflow on push or pull request
# events, but only for the master branch we'll create .zip files
on:
[push, pull_request]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This job builds the plugin for our target platforms
build:
name: Building for ${{ matrix.platform }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
# I don't think this matrix is needed anymore...
- os: ubuntu-20.04
platform: android
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Setup actions
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Setup java
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'adopt'
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.8 #install the python needed
# for android, run generate bindings python script
- name: Generate bindings (Android)
run: |
cd $GITHUB_WORKSPACE/plugin/libs/godot-cpp
python ../../../generate.py
if: matrix.platform == 'android'
# then run gradlew to build aar
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Run the build for godot_arcore
run: |
cd $GITHUB_WORKSPACE
./gradlew :generatePluginBinary
# for android, copy aar
- name: Upload build files (artifacts)
uses: actions/upload-artifact@v2
with:
name: build-files-arcore
path: |
plugin/build/outputs/pluginBin/*.aar
plugin/gdarcore.gdap
# This job collects the build output and assembles the final asset (artifact)
asset:
name: Assembling the asset (artifact)
runs-on: ubuntu-20.04
needs: build
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags'))
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
with:
repository: 'GodotVR/godot_arcore'
path: godot_arcore
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
- name: Copy files to destination
run: |
mkdir godot_arcore_plugin
mkdir godot_arcore_plugin/addons
mkdir godot_arcore_plugin/android
mkdir godot_arcore_plugin/android/plugins
cp -r godot_arcore/demo/addons/godot_arcore godot_arcore_plugin/addons
cp build-files-arcore/*.aar godot_arcore_plugin/android/plugins/
cp build-files-arcore/gdarcore.gdap godot_arcore_plugin/android/plugins/godot_openxr.gdap
- name: Calculate GIT short ref
run: |
cd godot_arcore
echo "GITHUB_SHA_SHORT=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
cd ..
if: github.ref == 'refs/heads/master'
- name: Get tag name
run: |
echo "GITHUB_SHA_SHORT=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags')
- name: Clean up extracted files
run: |
rm -rf build-files-arcore
rm -rf godot_arcore
rm -rf .git
mv godot_arcore_plugin godot_arcore_${{ env.GITHUB_SHA_SHORT }}
- name: Zip asset
run: |
zip -qq -r godot_arcore.zip .
- name: Create and upload asset
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "godot_arcore.zip"
body: "New release!"
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
if: startsWith(github.ref, 'refs/tags')
- name: Create release for asset
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.GITHUB_SHA_SHORT }}
release_name: Automatic build for changeset ${{ env.GITHUB_SHA_SHORT }}
body: |
This is an automated build for changeset ${{ env.GITHUB_SHA_SHORT }}
draft: false
prerelease: true
if: github.ref == 'refs/heads/master'
- name: Upload asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./godot_arcore.zip
asset_name: godot_arcore.zip
asset_content_type: application/zip
if: github.ref == 'refs/heads/master'