version display tweaks #7
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: Publish web app version to gh-pages | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
- "*" | |
paths: | |
# This action only runs on push when C++ files are changed | |
- "**.cpp" | |
- "**.h" | |
- "**.cmake" | |
- "**Lists.txt" | |
- "**-emscripten.yml" | |
workflow_dispatch: | |
env: | |
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules | |
jobs: | |
build: | |
name: Build and deploy | |
runs-on: macos-12 | |
steps: | |
- name: Install dependencies | |
run: brew install ninja emscripten | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: "**/cpm_modules" | |
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} | |
# Setup caching of build artifacts to reduce total build time (only Linux and MacOS) | |
- name: ccache | |
uses: hendrikmuhs/[email protected] | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Configure CMake | |
run: | | |
emcmake cmake -B ${{github.workspace}}/build -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --parallel 4 | |
- name: Archive build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifacts | |
path: | | |
${{github.workspace}}/build | |
- name: Copy web app | |
working-directory: ${{github.workspace}}/build | |
run: | | |
mkdir deploy | |
cp Samplin\ Safari.data Samplin\ Safari.html Samplin\ Safari.js Samplin\ Safari.wasm deploy/ | |
mv deploy/Samplin\ Safari.html deploy/index.html | |
- name: Publish | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
personal_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: gh-pages | |
publish_dir: ${{github.workspace}}/build/deploy |