ci: Update deploy workflow met test en build splitsing #15
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
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: π₯ Checkout repository | |
uses: actions/checkout@v3 | |
- name: ποΈ Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
cache: "pnpm" | |
- name: π¦ Install PNPM | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: π¦ Install dependencies | |
run: pnpm install | |
- name: π§ͺ Run Tests | |
run: pnpm test | |
deploy: | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
needs: build-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: π₯ Checkout repository | |
uses: actions/checkout@v3 | |
- name: ποΈ Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
cache: "pnpm" | |
- name: π¦ Install PNPM | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: π¦ Install dependencies | |
run: pnpm install | |
- name: ποΈ Copy _redirects file | |
run: cp public/_redirects docs/_redirects || echo "No _redirects found" | |
- name: π¨ Build project | |
run: pnpm run build | |
- name: π Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs | |
keep_files: true |