algram #441
Workflow file for this run
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: pages | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
packages: write | |
contents: write | |
jobs: | |
build-app: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
cache: "npm" | |
cache-dependency-path: frontend/package-lock.json | |
- name: Install dependencies | |
run: npm ci | |
working-directory: frontend | |
- name: Build Static Web App | |
run: npm run build -- --base=$BASE_URL | |
env: | |
BASE_URL: ${{ github.event.repository.name }} | |
VITE_FACE_API_KEY: ${{ secrets.VITE_FACE_API_KEY }} | |
VITE_SPEECH_API_KEY: ${{ secrets.VITE_SPEECH_API_KEY }} | |
VITE_IMAGE_API_URL: ${{secrets.VITE_IMAGE_API_URL}} | |
VITE_FACE_API_ENDPOINT: ${{secrets.VITE_FACE_API_ENDPOINT}} | |
VITE_VISION_API_ENDPOINT: ${{secrets.VITE_VISION_API_ENDPOINT}} | |
VITE_VISION_API_KEY: ${{secrets.VITE_VISION_API_KEY}} | |
VITE_CHAT_API_ENDPOINT: ${{secrets.VITE_CHAT_API_ENDPOINT}} | |
working-directory: frontend | |
- name: Upload result of Static Web App build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: static-webapp | |
path: frontend/dist | |
build-documentation: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
if: github.repository_owner == 'microsoft' | |
with: | |
lfs: true | |
- uses: actions/setup-node@v3 | |
if: github.repository_owner == 'microsoft' | |
with: | |
node-version: "14" | |
- run: npm init -y | |
if: github.repository_owner == 'microsoft' | |
- run: npm install vuepress vuepress-plugin-code-copy | |
if: github.repository_owner == 'microsoft' | |
- run: node_modules/.bin/vuepress build | |
if: github.repository_owner == 'microsoft' | |
- name: Upload result of vuepress build | |
uses: actions/upload-artifact@v3 | |
if: github.repository_owner == 'microsoft' | |
with: | |
name: static-website | |
path: .vuepress/dist | |
if-no-files-found: error | |
deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- build-app | |
- build-documentation | |
environment: | |
name: pages | |
url: https://${{ github.repository_owner }}.github.io/everyonecancode | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Download build of static app | |
uses: actions/download-artifact@v3 | |
with: | |
name: static-webapp | |
path: dist | |
- name: Download build of static website | |
uses: actions/download-artifact@v3 | |
if: github.repository_owner == 'microsoft' | |
with: | |
name: static-website | |
path: dist/instructions | |
- name: Deploy to GitHub Pages | |
uses: crazy-max/ghaction-github-pages@v3 | |
with: | |
build_dir: dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |