fleet/.github/workflows/deploy-fleet-website.yml
Mike McNeil 578a1a01ff cleanup
2020-12-02 02:14:44 -06:00

61 lines
2.3 KiB
YAML

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
# And then more things
name: Deploy Fleet website
on:
push:
branches: [ website ]
pull_request:
branches: [ ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
# Now start building!
# > …but first, get a little crazy for a sec and delete the top-level package.json file
# > i.e. the one used by the Fleet server. This is because require() in node will go
# > hunting in ancestral directories for missing dependencies, and since some of the
# > bundled transpiler tasks sniff for package availability using require(), this trips
# > up when it encounters another Node universe in the parent directory.
- run: rm -rf package.json package-lock.json node_modules/
# > Turns out there's a similar issue with how eslint plugins are looked up, so we
# > delete the top level .eslintrc file too.
- run: rm -f .eslintrc.js
# Get dependencies (including dev deps)
- run: cd website/ && npm install
# Run sanity checks
- run: cd website/ && npm test
# Compile assets
- run: cd website/ && npm run build
# Commit built assets locally so we can push them to Heroku below.
# (This commit will never be pushed to GitHub- only to Heroku.)
- run: git add .www
- run: git -c "user.name=Fleetwood" -c "user.email=github@example.com" commit -am 'AUTOMATED COMMIT - Automatically bundling compiled assets as part of deploy, updating the EJS layout and .sailsrc file accordingly.'
# Deploy to Heroku (by pushing)
- run: echo "Deploying branch '${GITHUB_REF##*/}' to Heroku…"
- run: git remote -v
# - run: cd website/ && git push heroku HEAD:master
# Hooray!
- run: echo '' && echo '--' && echo 'OK, done. It should be live momentarily.' && echo '(if you get impatient, check the Heroku dashboard for status)' && echo && echo ' 🌐–• https://fleetdm.com'