Build EJS and Deploy to Pages #14
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 EJS and Deploy to Pages | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v*.* | |
workflow_dispatch: | |
inputs: | |
nodeploy: | |
description: 'Prevent Deployment (Build only)' | |
required: false | |
type: boolean | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
env: | |
GAME_VERSION: 1.21.51 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Latest Git Tag & Commit | |
run: | | |
echo "GIT_TAG=$(git describe --tags --abbrev=0 | cut -c2-)" >> $GITHUB_ENV | |
echo "GIT_SHORT_SHA=$(echo ${{ github.sha }} | cut -c-7)" >> $GITHUB_ENV | |
- | |
name: Set Service Worker Cache Version | |
run: | | |
sed 's/{{COMMIT_VERSION}}/${{ env.GIT_SHORT_SHA }}/g' sw.js > sw.js | |
- | |
name: Build index.html | |
uses: jaywcjlove/action-ejs@main | |
with: | |
template-file: templates/index.ejs | |
output: index.html | |
vars: | | |
{"GAME_VERSION": "${{ env.GAME_VERSION }}", "APP_VERSION": "${{ env.GIT_TAG }}"} | |
- | |
name: Build manual.html | |
uses: jaywcjlove/action-ejs@main | |
with: | |
template-file: templates/manual.ejs | |
output: manual.html | |
vars: | | |
{"GAME_VERSION": "${{ env.GAME_VERSION }}", "APP_VERSION": "${{ env.GIT_TAG }}"} | |
- | |
name: Build about.html | |
uses: jaywcjlove/action-ejs@main | |
with: | |
template-file: templates/about.ejs | |
output: about.html | |
vars: | | |
{"GAME_VERSION": "${{ env.GAME_VERSION }}", "APP_VERSION": "${{ env.GIT_TAG }}"} | |
- | |
name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- | |
name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: '.' | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
if: ${{ ! inputs.nodeploy }} | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |