Use github action for deploy
This commit is contained in:
parent
895068f78d
commit
93c4e2287d
3 changed files with 49 additions and 73 deletions
|
@ -1,73 +0,0 @@
|
|||
version: 2.1
|
||||
orbs:
|
||||
node: circleci/node@1.1.6
|
||||
|
||||
jobs:
|
||||
lint-and-build:
|
||||
executor:
|
||||
name: node/default
|
||||
environment:
|
||||
NETLIFY_SITE_ID: airboardgame.netlify.app
|
||||
VITE_SOCKET_URL: https://ricochetjs.herokuapp.com/
|
||||
VITE_API_ENDPOINT: /api
|
||||
VITE_RICOCHET_SITEID: airboardgame
|
||||
VITE_USE_PROXY: 0
|
||||
CYPRESS_INSTALL_BINARY: 0
|
||||
steps:
|
||||
- checkout
|
||||
- node/with-cache:
|
||||
steps:
|
||||
- run: node --version
|
||||
- run: npm ci
|
||||
- run: npm run lint
|
||||
- run: cd backend && npm ci && npm run build
|
||||
- run: npm run build
|
||||
- run: |
|
||||
cat \<<EOF > ./dist/_redirects
|
||||
/api/* https://ricochetjs.herokuapp.com/:splat 200
|
||||
/* /index.html 200
|
||||
EOF
|
||||
- run:
|
||||
name: Netlify Deploy
|
||||
command: npx netlify deploy --dir=./dist --site $NETLIFY_SITE_ID --auth $NETLIFY_ACCESS_TOKEN
|
||||
|
||||
build-deploy:
|
||||
executor:
|
||||
name: node/default
|
||||
environment:
|
||||
NETLIFY_SITE_ID: airboardgame.netlify.app
|
||||
VITE_SOCKET_URL: https://ricochetjs.herokuapp.com/
|
||||
VITE_USE_PROXY: 0
|
||||
VITE_API_ENDPOINT: /api
|
||||
VITE_RICOCHET_SITEID: airboardgame
|
||||
CYPRESS_INSTALL_BINARY: 0
|
||||
steps:
|
||||
- checkout
|
||||
- node/with-cache:
|
||||
steps:
|
||||
- run: npm ci
|
||||
- run: npm run lint
|
||||
- run: cd backend && npm ci && npm run build
|
||||
- run: npm run build
|
||||
- run: |
|
||||
cat \<<EOF > ./dist/_redirects
|
||||
/api/* https://ricochetjs.herokuapp.com/:splat 200
|
||||
/* /index.html 200
|
||||
EOF
|
||||
- run:
|
||||
name: Netlify Deploy
|
||||
command: npx netlify deploy --site $NETLIFY_SITE_ID --auth $NETLIFY_ACCESS_TOKEN --dir=dist --prod
|
||||
|
||||
workflows:
|
||||
build-and-test:
|
||||
jobs:
|
||||
- lint-and-build:
|
||||
filters:
|
||||
branches:
|
||||
ignore:
|
||||
- master
|
||||
- build-deploy:
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
49
.github/workflows/lint-deploy.yml
vendored
Normal file
49
.github/workflows/lint-deploy.yml
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
# .github/workflows/netlify.yml
|
||||
name: Build and Deploy to Netlify
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
|
||||
- run: npm install -g npm && npm ci && npm rebuild node-sass
|
||||
- run: npm run lint
|
||||
- run: cd backend && npm ci && npm run build
|
||||
env:
|
||||
RICOCHET_SECRET_KEY: ${{ secrets.RICOCHET_SECRET_KEY }}
|
||||
- run: npm run build
|
||||
env:
|
||||
VITE_SOCKET_URL: https://ricochetjs.herokuapp.com/
|
||||
VITE_API_ENDPOINT: /api
|
||||
VITE_RICOCHET_SITEID: airboardgame
|
||||
VITE_USE_PROXY: 0
|
||||
CYPRESS_INSTALL_BINARY: 0
|
||||
- run: |
|
||||
cat <<EOF > ./dist/_redirects
|
||||
/api/* https://ricochetjs.herokuapp.com/:splat 200
|
||||
/* /index.html 200
|
||||
EOF
|
||||
- run: cat ./dist/_redirects
|
||||
- run: ls ./dist
|
||||
|
||||
- name: Deploy to Netlify
|
||||
uses: nwtgck/actions-netlify@v1.1
|
||||
with:
|
||||
publish-dir: './dist'
|
||||
production-branch: master
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
deploy-message: "Deploy from GitHub Actions"
|
||||
enable-pull-request-comment: false
|
||||
enable-commit-comment: true
|
||||
overwrites-pull-request-comment: true
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
timeout-minutes: 1
|
Loading…
Reference in a new issue