Merge pull request #19 from chieftools/dependabot/github_actions/acti… #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to GitHub Pages | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
permissions: | |
pages: write | |
contents: read | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
cache: yarn | |
node-version: 16 | |
- name: Restore cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.next/cache | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}- | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Copy .env file | |
run: cp .env.example .env.local | |
- name: Build with Next.js | |
run: yarn next build | |
- name: Static HTML export with Next.js | |
run: yarn next export | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: ./out | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |
index: | |
runs-on: ubuntu-latest | |
needs: [ deploy ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Give GitHub a little time to deploy | |
run: sleep 30s | |
- name: Get DocSearch config | |
id: algolia_config | |
run: echo "config=$(cat docsearch_config.json | jq -r tostring)" >> $GITHUB_OUTPUT | |
- name: Index to Algolia | |
uses: signcl/[email protected] | |
env: | |
APPLICATION_ID: ${{ secrets.ALGOLIA_APP_ID }} | |
API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | |
CONFIG: ${{ steps.algolia_config.outputs.config }} |