ci: Update upload-artifact action #166
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 | |
on: [push] | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
package: | |
runs-on: ubuntu-latest | |
container: | |
image: wonderlandengine/editor:latest | |
steps: | |
- name: Install | |
run: yes | apt-get install git git-lfs | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Package | |
run: | | |
apt install -y zip | |
mkdir public | |
for project in * ; do | |
if [ ! -d "$project" ]; then continue; fi | |
if [ "$project" = ".github" ]; then continue; fi | |
if [ "$project" = "public" ]; then continue; fi | |
# react-embed has special build instructions | |
if [ "$project" = "react-embed" ]; then continue; fi | |
echo "Zipping $project" | |
zip -r ./public/$project.zip $project | |
echo "Building $project" | |
for projectFile in $project/*.wlp ; do | |
/usr/local/bin/entrypoint.sh WonderlandEditor --credentials "$WLE_CREDENTIALS" --windowless --package --project ./$projectFile --output ./public/ | |
done | |
mv public/index.html public/$project.html | |
done | |
# Special build for 'react-embed' | |
echo "Zipping react-embed" | |
zip -r ./public/$react-embed.zip $project | |
echo "Building react-embed" | |
/usr/local/bin/entrypoint.sh WonderlandEditor --credentials "$WLE_CREDENTIALS" --windowless --package --project ./react-embed/wonderland/React.wlp | |
cd ./react-embed | |
npm ci | |
npm run build | |
cd .. | |
cp -r react-embed/dist/* public/ | |
mv public/index.html public/react-embed.html | |
env: | |
WLE_CREDENTIALS: ${{ secrets.WLE_CREDENTIALS }} | |
- name: Gzip | |
run: gzip -k public/**/*.* | |
- name: Upload package artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wonderland-engine-examples-deploy | |
path: public/ | |
- name: Upload pages artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./public | |
deploy-pages: | |
needs: package | |
if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v2 |