From 4461005a912d2e5eafeaecb56a1ccfe438b33e9f Mon Sep 17 00:00:00 2001 From: Jonathan Sick Date: Tue, 14 Sep 2021 11:59:57 -0400 Subject: [PATCH 1/3] Add deployment workflow to GitHub Pages This uses the https://github.com/peaceiris/actions-gh-pages GitHub Action for the deployment to GitHub Pages for any merge to `main`. The one thing this workflow is missing is how to incorporate tutorials content in the same GitHub Pages build. --- .github/workflows/deploy.yaml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/deploy.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..844dc9d --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,34 @@ +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 }} + + - 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 From c3ea9a1c5332e71ef0883f2cb1491050cad62545 Mon Sep 17 00:00:00 2001 From: Jonathan Sick Date: Tue, 14 Sep 2021 12:04:00 -0400 Subject: [PATCH 2/3] Add npm package caching --- .github/workflows/ci.yaml | 8 ++++++++ .github/workflows/deploy.yaml | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5091924..faa89b4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,6 +20,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 index 844dc9d..773bdd0 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -21,6 +21,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 From bdcc69c152379344ccacc27a1a47967f0661606e Mon Sep 17 00:00:00 2001 From: Jonathan Sick Date: Tue, 14 Sep 2021 12:25:58 -0400 Subject: [PATCH 3/3] Limit checking push events to main branch --- .github/workflows/ci.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index faa89b4..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: