Read some workflow config from environment variables #8
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 changes | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
check-lighthouse-scores: | |
name: Check lighthouse scores | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: npm ci | |
- run: cp .env.ci .env | |
- run: npm run build -- --mode=test | |
- run: npm run lhci -- --upload.token=$LHCI_BUILD_TOKEN | |
env: | |
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} | |
LHCI_BUILD_TOKEN: ${{ secrets.LHCI_BUILD_TOKEN }} | |
run-unit-tests: | |
name: Run unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cypress-io/github-action@v6 | |
with: | |
component: true | |
browser: chrome | |
deploy-to-production: | |
name: Deploy to production | |
runs-on: ubuntu-latest | |
needs: [check-lighthouse-scores, run-unit-tests] | |
environment: production | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: npm ci | |
- run: npm run build | |
env: | |
VITE_PUBLIC_FUNCTIONS_URL: ${{ vars.VITE_PUBLIC_FUNCTIONS_URL }} | |
VITE_PUBLIC_IS_WEB_BUILD: ${{ vars.VITE_PUBLIC_IS_WEB_BUILD }} | |
VITE_PUBLIC_SENTRY_DSN: ${{ vars.VITE_PUBLIC_SENTRY_DSN }} | |
VITE_PUBLIC_SENTRY_ENVIRONMENT: ${{ vars.VITE_PUBLIC_SENTRY_ENVIRONMENT }} | |
FUNCTIONS_SENTRY_ENVIRONMENT: ${{ vars.FUNCTIONS_SENTRY_ENVIRONMENT }} | |
- uses: netlify/actions/cli@master | |
with: | |
args: deploy --prod | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |