From b15288ef427b17f765100838b83075a5adaba22e Mon Sep 17 00:00:00 2001 From: Magnus Smari Smarason Date: Sat, 17 May 2025 22:07:28 +0000 Subject: [PATCH] Fix commit --- .github/workflows/deploy.yml | 51 +++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ff17bbd..149e215 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,28 +1,55 @@ name: Deploy to GitHub Pages on: + # Runs on pushes targeting the default branch push: - branches: - - main # Or your default branch + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false jobs: - deploy: + # Build job + build: runs-on: ubuntu-latest - permissions: - contents: write # Allows gh-pages to push to the gh-pages branch steps: - - name: Checkout repository + - name: Checkout uses: actions/checkout@v4 - - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: '20' # Or your preferred Node.js version - + node-version: "20" # Or your preferred Node.js version + cache: "npm" - name: Install dependencies run: npm ci + - name: Build + run: npm run build # This should output to 'dist' based on your package.json + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload dist folder + path: "./dist" + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: - name: Deploy to GitHub Pages - run: npx gh-pages -d dist --repo "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" --user "GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Ensures token is available if gh-pages or git commands need it directly \ No newline at end of file + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file