Add authentication and test #2
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 to Github Pages on PR | |
on: | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CI: false | |
jobs: | |
build: | |
if: "${{ github.event.pull_request.head.repo.full_name == github.repository }}" | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
pages: 'write' | |
actions: 'write' | |
checks: 'write' | |
deployments: 'write' | |
strategy: | |
matrix: | |
node-version: [18.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Install dependencies | |
# Using npm ci is generally faster than running npm i because it caches dependencies | |
run: | | |
touch .env | |
echo 'VITE_HANKO_API_URL_LOCAL=${{secrets.VITE_HANKO_API_URL_LOCAL}}' >> .env | |
echo 'VITE_HANKO_API_URL_PROD=${{secrets.VITE_HANKO_API_URL_LOCAL}}' >> .env | |
ls -la | |
cat .env | |
npm ci | |
- name: Build the app | |
run: | | |
npm run build | |
- name: Run component tests | |
run: | | |
npm run test:unit | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload build directory content | |
path: 'dist/' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |