diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 5f18ebc..21feefb 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,34 +1,49 @@ -name: cd +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages -on: [push, pull_request] +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] -jobs: - cd: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest] - node: [18] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: - steps: - - name: Checkout - uses: actions/checkout@master +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write - - name: Setup node env - uses: actions/setup-node@v4 - - with: - node-version: ${{ matrix.node }} +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true - - name: Install dependencies +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + container: node:18.14.0 + steps: + - name: 🛎️ Checkout + uses: actions/checkout@v3 + - name: 📦 Install run: npm i - - - name: Generate - run: npm run generate - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 + - name: ✅ Test + run: npm run test:unit + - name: 🏗 Build + run: npm run build + - name: ⚙️ Setup Pages + uses: actions/configure-pages@v2 + - name: ⬆️ Upload artifact + uses: actions/upload-pages-artifact@v1 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist \ No newline at end of file + # Upload entire repository + path: './dist' + - name: 🚀 Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 \ No newline at end of file