Skip to content

[ci/wasm] Use devcontainers for webassembly deployement #35

[ci/wasm] Use devcontainers for webassembly deployement

[ci/wasm] Use devcontainers for webassembly deployement #35

Workflow file for this run

name: Build WebAssembly of fotowall
on:
push:
paths-ignore:
# Changes to those files don't mandate running CI
- ".github/workflows/package.yml"
- ".github/workflows/build.yml"
- "debian/**"
- "README.md"
- "doc/**"
- ".pre-commit-config.yaml"
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
build-webassembly:
strategy:
fail-fast: false
matrix:
os: ["ubuntu_22.04"]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and run Dev Container task
uses: devcontainers/[email protected]
with:
# Change this to point to your image name
imageName: ghcr.io/fotowall/qt6-emscripten
configFile: ./.devcontainer/qt6-emscripten/devcontainer.json
refFilterForPush: refs/heads/master
# Change this to be your CI task/script
runCmd: |
# Add multiple commands to run if needed
mkdir build
cd build
qt-cmake -GNinja ..
ninja
- name: Bundle Webassembly Files
run: |
echo "::group::Bundle files"
cd $GITHUB_WORKSPACE/build
mkdir fotowall-webassembly
cp fotowall.js fotowall.html fotowall.wasm qtloader.js qtlogo.svg fotowall-webassembly
tar -czf fotowall-webassembly.tar.gz fotowall-webassembly
cp -r fotowall-webassembly /home/runner/work/fotowall/fotowall
echo "::endgroup::"
echo "::group::List files"
ls -R $GITHUB_WORKSPACE/build/fotowall-webassembly
echo "::endgroup::"
- name: Push WebAssembly to Cloudsmith
id: push
if: github.ref == 'refs/heads/topic/WebAssembly' && github.repository == 'arntanguy/fotowall'
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: "push"
format: "raw"
owner: "arntanguy"
repo: "head"
file: "$GITHUB_WORKSPACE/build/fotowall-webassembly.tar.gz"
tags: "latest"
name: "fotowall-webassembly-latest.tar.gz"
summary: "Upload latest webassembly build"
description: "See https://github.com/cloudsmith-io/action"
version: ${{ github.sha}}
- name: Deploy to gh-pages 🚀
if: github.ref == 'refs/heads/topic/WebAssembly' && github.repository == 'arntanguy/fotowall'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build/fotowall-webassembly # The folder the action should deploy.