Skip to content

cd: fix missing .env file #4

cd: fix missing .env file

cd: fix missing .env file #4

Workflow file for this run

name: Build website and deploy to Github Pages
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
permissions:
contents: write
env:
APPLICATION_ID: ${{ secrets.APPLICATION_ID }}
API_KEY: ${{ secrets.API_KEY }}
INDEX_NAME: ${{ secrets.INDEX_NAME }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
- name: Install dependencies
run: npm install
- name: Write .env file
run: |
echo -e "APPLICATION_ID=${{ secrets.APPLICATION_ID }}\nAPI_KEY=${{ secrets.API_KEY }}\nINDEX_NAME=${{ secrets.INDEX_NAME }}" > .env
- name: Build website
run: npm run build
- name: Create .nojekyll file for GitHub Pages
run: |
touch build/test-site/.nojekyll
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
user_name: liuyuweitarek
user_email: [email protected]
- name: Get the content of algolia.json as config
id: algolia_config
run: echo "config=$(cat ./algolia/prod-algolia-config.json | jq -r tostring)" >> $GITHUB_OUTPUT
- name: Push indices to Algolia
uses: signcl/docsearch-scraper-action@master
env:
INDEX_NAME: ${{ secrets.INDEX_NAME }}
APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
CONFIG: ${{ steps.algolia_config.outputs.config }}