build-demos-concurrently #44
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: build-demos-concurrently | |
on: | |
push: | |
branches: [master] | |
workflow_dispatch: | |
repository_dispatch: | |
jobs: | |
get-demos: | |
runs-on: ubuntu-latest | |
outputs: | |
result: ${{ steps.find-demos.outputs.result }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
clean: 'false' | |
- name: Checkout demos repository | |
uses: actions/checkout@v4 | |
with: | |
repository: 'HaxeFlixel/flixel-demos' | |
submodules: 'recursive' | |
ref: 'dev' | |
clean: 'false' | |
path: 'demos' | |
- uses: actions/cache@v4 | |
with: | |
path: /home/runner/haxe | |
key: haxelib-${{ runner.os }} | |
- uses: lix-pm/setup-lix@master | |
- uses: HaxeFlixel/setup-flixel@v1 | |
with: | |
haxe-version: stable | |
flixel-versions: dev | |
target: html5 | |
- name: Find all demo folders | |
uses: actions/github-script@v7 | |
id: find-demos | |
with: | |
retries: 3 | |
script: | | |
// runs the script to get all the demo folders | |
// and returns the output, which will be an array | |
// of paths | |
// note: actions/github-script will encode the result | |
// in JSON! we decode it later | |
const script = require("./js/getDemos.js"); | |
return script({core}); | |
build-demo: | |
runs-on: ubuntu-latest | |
needs: get-demos | |
strategy: | |
fail-fast: false | |
matrix: | |
demo-path: ${{ fromJson(needs.get-demos.outputs.result) }} | |
steps: | |
- name: Get Demo Name | |
uses: actions/github-script@v7 | |
id: demo-name | |
with: | |
result-encoding: string | |
retries: 3 | |
script: | | |
return '${{ matrix.demo-path }}'.split('/').pop(); | |
- name: Checkout demos repository | |
uses: actions/checkout@v4 | |
with: | |
repository: 'HaxeFlixel/flixel-demos' | |
submodules: 'recursive' | |
ref: 'dev' | |
clean: 'false' | |
sparse-checkout: ${{ matrix.demo-path }} | |
- uses: lix-pm/setup-lix@master | |
- uses: actions/cache@v4 | |
with: | |
path: /home/runner/haxe | |
key: haxelib-${{ runner.os }} | |
- run: | | |
cd ${{ matrix.demo-path }} | |
haxelib run lime build html5 -- -final | |
ls -lR | |
- name: Move export to new folder | |
run: | | |
mkdir ${{steps.demo-name.outputs.result}} | |
mv ${{ matrix.demo-path }}/export/html5/bin/* ${{steps.demo-name.outputs.result}} | |
- run: ls -lR | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{steps.demo-name.outputs.result}} | |
path: ${{steps.demo-name.outputs.result}}/ | |
retention-days: 1 | |
compression-level: 1 | |
publish-site: | |
runs-on: ubuntu-latest | |
needs: build-demo | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
- run: | | |
mkdir html5 | |
for d in */; do | |
if [ "$d" != "html5/" ]; then | |
mv "$d" html5/ | |
fi | |
done | |
shell: bash | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{secrets.GITHUB_TOKEN}} | |
publish_dir: . | |
force_orphan: true | |
cname: demos.haxeflixel.com |