Skip to content

Instantly share code, notes, and snippets.

@stevenwaterman
Created February 24, 2020 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevenwaterman/3b5cf6bae7521c0fca400c7a3e1ede97 to your computer and use it in GitHub Desktop.
Save stevenwaterman/3b5cf6bae7521c0fca400c7a3e1ede97 to your computer and use it in GitHub Desktop.
A GitHub Actions worflow for automatic front-end build & deployment with GitHub Pages
name: AutomaticHost
on:
push:
branches:
- {BRANCH_NAME}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '10.x'
- run: |
npm ci
{BUILD_COMMAND}
- run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git checkout --orphan gh-pages
git reset
git add {OUT_DIR}/* -f
git mv {OUT_DIR}/* ./ -k
git commit -m "Update hosted version"
- uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true
branch: gh-pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment