Skip to content

Release 1.1.0

Release 1.1.0 #23

Workflow file for this run

name: Publish
on:
push:
branches:
- main
workflow_dispatch:
# Set GITHUB_TOKEN
permissions:
contents: write
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-22.04
env:
FORCE_COLOR: "1"
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- uses: actions/[email protected]
with:
node-version: 18.x
- run: npm install
- name: Generate coverage
run: npm test
- name: Deploy
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DEPLOY_PREP: /tmp/deployment-prep
DEPLOY_BRANCH: gh-pages
run: |
mkdir -p "${DEPLOY_PREP}" && cd "${DEPLOY_PREP}"
# Clone and checkout existing branch, or initialise with a new and empty branch
git clone --depth 5 --branch "${DEPLOY_BRANCH}" "https://github.com/${GITHUB_REPOSITORY}.git" . || git init -b "${DEPLOY_BRANCH}"
# Snapshot
cp -R $GITHUB_WORKSPACE/{*.*,assets,coverage,demo,test} .
# Modifications
touch .nojekyll
cp assets/gh-pages.html index.html
# Push
git config user.name "${GITHUB_ACTOR}" && \
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" && \
git add . && \
git commit --allow-empty -m "Build commit ${GITHUB_SHA}" && \
git push "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "HEAD:${DEPLOY_BRANCH}"