From 149acd645135465ada77113ee592db24f610490d Mon Sep 17 00:00:00 2001 From: iceniveth Date: Sat, 29 Apr 2023 17:54:57 +0800 Subject: [PATCH 1/3] Deploy app on Github Pages --- .github/workflows/on-push-build-deploy.yml | 50 ++++++++++++++++++++ .github/workflows/on-push-lint-and-build.yml | 32 ++++++------- vite.config.ts | 5 +- 3 files changed, 69 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/on-push-build-deploy.yml diff --git a/.github/workflows/on-push-build-deploy.yml b/.github/workflows/on-push-build-deploy.yml new file mode 100644 index 0000000..0fec3b7 --- /dev/null +++ b/.github/workflows/on-push-build-deploy.yml @@ -0,0 +1,50 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages + +on: + pull_request: + branches: [main] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +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: Set up Node + uses: actions/setup-node@v3 + with: + node-version: 14.19.3 + cache: "npm" + - 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@v1 + with: + # Upload dist repository + path: "./dist" + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/.github/workflows/on-push-lint-and-build.yml b/.github/workflows/on-push-lint-and-build.yml index 6989127..f62018a 100644 --- a/.github/workflows/on-push-lint-and-build.yml +++ b/.github/workflows/on-push-lint-and-build.yml @@ -1,16 +1,16 @@ -name: on-pull-request-lint-and-build -on: - pull_request: - branches: [main] -jobs: - checks-app-code-standard: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: "14.19.3" - - run: npm install - - run: npm run prettier:check - - run: npm run lint - - run: npm run build +# name: on-pull-request-lint-and-build +# on: +# pull_request: +# branches: [main] +# jobs: +# checks-app-code-standard: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - uses: actions/setup-node@v3 +# with: +# node-version: "14.19.3" +# - run: npm install +# - run: npm run prettier:check +# - run: npm run lint +# - run: npm run build diff --git a/vite.config.ts b/vite.config.ts index ac39438..5a7c96d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,6 +3,7 @@ import react from "@vitejs/plugin-react"; import eslint from "vite-plugin-eslint"; // https://vitejs.dev/config/ -export default defineConfig({ +export default defineConfig(({ command }) => ({ + base: command === "serve" ? "/" : "/stack-ilearning", plugins: [react(), eslint()], -}); +})); From 02179855bf4c6820ef27003d4521a5a88c5bf7b8 Mon Sep 17 00:00:00 2001 From: Ken Tan Date: Wed, 10 May 2023 14:24:17 +0800 Subject: [PATCH 2/3] Create CNAME --- CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 CNAME diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..f46642f --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +ilearning.stacktrek.com \ No newline at end of file From e6c521d93a1c10b6f63daf6a3ecc1235a572f5e0 Mon Sep 17 00:00:00 2001 From: Ken Tan Date: Wed, 10 May 2023 14:36:09 +0800 Subject: [PATCH 3/3] Delete CNAME --- CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 CNAME diff --git a/CNAME b/CNAME deleted file mode 100644 index f46642f..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -ilearning.stacktrek.com \ No newline at end of file