From 93c4e2287dde0f2977e410f525e48893fbe579ff Mon Sep 17 00:00:00 2001 From: Jeremie Pardou-Piquemal <571533+jrmi@users.noreply.github.com> Date: Sun, 18 Apr 2021 09:50:01 +0200 Subject: [PATCH] Use github action for deploy --- .circleci/config.yml | 73 --------------------- .github/workflows/{main.yml => cypress.yml} | 0 .github/workflows/lint-deploy.yml | 49 ++++++++++++++ 3 files changed, 49 insertions(+), 73 deletions(-) delete mode 100644 .circleci/config.yml rename .github/workflows/{main.yml => cypress.yml} (100%) create mode 100644 .github/workflows/lint-deploy.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 0ada1a8..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -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 \< ./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 \< ./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 diff --git a/.github/workflows/main.yml b/.github/workflows/cypress.yml similarity index 100% rename from .github/workflows/main.yml rename to .github/workflows/cypress.yml diff --git a/.github/workflows/lint-deploy.yml b/.github/workflows/lint-deploy.yml new file mode 100644 index 0000000..367d54d --- /dev/null +++ b/.github/workflows/lint-deploy.yml @@ -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 < ./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