Skip to content

Instantly share code, notes, and snippets.

@afifalfiano
Last active July 25, 2020 04:33
Show Gist options
  • Save afifalfiano/09193eb1cc854cea337e467dc6edd584 to your computer and use it in GitHub Desktop.
Save afifalfiano/09193eb1cc854cea337e467dc6edd584 to your computer and use it in GitHub Desktop.
Github Action Auto Deployment
name: Build and Deploy
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/setup-node@v1 #this installs node and npm for us
with:
node-version: '12'
- uses: actions/cache@v1 # this allows for re-using node_modules caching, making builds a bit faster.
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build
run: |
npm install
npm run-script deploy
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: dist/myProject
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment