Build frontend #1296
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: Build frontend | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '18 4 * * *' | |
jobs: | |
build-and-deploy-if-main: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: catalog-validation | |
fetch-depth: 0 | |
- name: Update branch | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git checkout main | |
git fetch origin | |
git checkout catalog-validation | |
git pull | |
git merge origin/main | |
git push origin catalog-validation | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
cache-dependency-path: "./frontend/package-lock.json" | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install Scivision.Py | |
run: | | |
pip install . | |
- name: Install node packages | |
working-directory: frontend | |
run: npm ci | |
- name: Build | |
working-directory: frontend | |
run: npm run build && cp ./dist/index.html ./dist/404.html && cp ./CNAME ./dist/CNAME | |
- name: Deploy | |
uses: JamesIves/[email protected] | |
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'schedule') | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: frontend/dist | |
clean: true | |