-
Notifications
You must be signed in to change notification settings - Fork 11
131 lines (121 loc) · 4.87 KB
/
build-on-push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# 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/godot-cpp
scons platform=android target=template_debug
scons platform=android target=template_release
if: matrix.platform == 'android'
- name: Run the build for godot_arcore
run: |
cd $GITHUB_WORKSPACE
./gradlew :assemble
# 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'