diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5091924..f546dad 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,8 +1,10 @@ name: CI 'on': - - push - - pull_request + push: + branches: + - main + pull_request: jobs: build: @@ -20,6 +22,14 @@ jobs: with: node-version: ${{ steps.node_version.outputs.NODE_VERSION }} + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ steps.node_version.outputs.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-${{ steps.node_version.outputs.NODE_VERSION }} + - run: npm ci name: Install diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..773bdd0 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,42 @@ +name: Deploy + +'on': + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Read .nvmrc + id: node_version + run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc) + + - name: Set up node + uses: actions/setup-node@v2 + with: + node-version: ${{ steps.node_version.outputs.NODE_VERSION }} + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ steps.node_version.outputs.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-${{ steps.node_version.outputs.NODE_VERSION }} + + - run: npm ci + name: Install + + - run: npm run build + name: Build + + - name: Deploy to gh-pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public