From ed38e8ef0fdfb613f031763dd59f58c04754929a Mon Sep 17 00:00:00 2001 From: Cweili <3weili@gmail.com> Date: Fri, 5 Jan 2024 16:35:01 +0800 Subject: [PATCH] chore: deploy github pages --- .github/workflows/deploy.yml | 51 ++++++++++++++++++++++++++++++++++++ package.json | 4 +-- 2 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..81cf995 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,51 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: [$default-branch] + + # 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: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: 20 + - name: Install dependencies + run: npm install + - name: Build + run: npm run build + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + # Upload entire repository + path: './build' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/package.json b/package.json index c682682..2b53e39 100644 --- a/package.json +++ b/package.json @@ -32,8 +32,7 @@ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "test": "vitest --typecheck", "lint": "prettier --check . && eslint --ignore-path .gitignore .", - "format": "prettier --write .", - "deploy": "npm run build && gh-pages -t -d build" + "format": "prettier --write ." }, "exports": { ".": { @@ -63,7 +62,6 @@ "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-svelte": "^2.35.1", - "gh-pages": "^6.1.1", "highlight.js": "^11.9.0", "jsdom": "^23.0.1", "prettier": "^3.1.1",