From 73c798634a40423cedfe7eda8ab8299b7d229b53 Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Sat, 26 Jun 2021 18:36:20 +0900 Subject: [PATCH] Update workflow --- .github/workflows/build-deploy.yml | 57 ++++++++++++++++++++++++++++++ .github/workflows/node.js.yml | 46 ------------------------ .gitignore | 23 ++++++++++++ 3 files changed, 80 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/build-deploy.yml delete mode 100644 .github/workflows/node.js.yml create mode 100644 .gitignore diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml new file mode 100644 index 0000000..50fe3c4 --- /dev/null +++ b/.github/workflows/build-deploy.yml @@ -0,0 +1,57 @@ +name: Build & deploy + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Node.js + uses: actions/setup-node@v1 + with: + node-version: 13.x + + - name: Install NPM packages + run: npm ci + + - name: Build project + run: npm run build + + - name: Run tests + run: npm run test + + - name: Upload production-ready build files + uses: actions/upload-artifact@v2 + with: + name: production-files + path: ./build + + deploy: + name: Deploy + needs: build + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: production-files + path: ./build + + - name: Deploy to gh-pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build \ No newline at end of file diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index da8a039..0000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: CI/CD - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [12.x] - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Install dependencies - run: npm install - - - name: Run the tests - run: npm test - - - name: Build - run: npm run build - - - name: Deploy - run: | - git config --global user.name sigonasr2 - git config --global user.email sigonasr2@yahoo.com - git remote set-url origin https://sigonasr2@github.com/ngsplanner - npm run deploy - env: - user_name: 'github-actions[bot]' - user_email: 'github-actions[bot]@users.noreply.github.com' - github_token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }} - repository: ${{ github.repository }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d29575 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log*