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()], -}); +}));