Skip to content

fix: add env var to workflow (#18) #73

fix: add env var to workflow (#18)

fix: add env var to workflow (#18) #73

Workflow file for this run

name: Build & Deploy
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
permissions:
pages: write
id-token: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
env:
VITE_S3_REGION: ${{ secrets.VITE_S3_REGION }}
VITE_S3_BUCKET_NAME: ${{ secrets.VITE_S3_BUCKET_NAME }}
VITE_S3_ACCESS_KEY: ${{ secrets.VITE_S3_ACCESS_KEY }}
VITE_S3_SECRET: ${{ secrets.VITE_S3_SECRET }}
VITE_TEST_ENDPOINT: ${{ secrets.VITE_TEST_ENDPOINT }}
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
if: github.ref == 'refs/heads/main'
with:
name: github-pages
path: ./dist
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
if: github.ref == 'refs/heads/main'