From c19ad666e21f97941f249fb40a13d7a6879b620e Mon Sep 17 00:00:00 2001 From: annsann Date: Mon, 6 May 2024 16:51:32 +0200 Subject: [PATCH] Try building frontend and deploying --- .github/workflows/build_frontend.yml | 43 ++++++++++++++++++++++++++++ frontend/vite.config.ts | 1 + 2 files changed, 44 insertions(+) create mode 100644 .github/workflows/build_frontend.yml diff --git a/.github/workflows/build_frontend.yml b/.github/workflows/build_frontend.yml new file mode 100644 index 00000000..0d8d9c99 --- /dev/null +++ b/.github/workflows/build_frontend.yml @@ -0,0 +1,43 @@ +name: Frontend Upload +on: + push: + paths: + - '.github/workflows/build_frontend.yml' + - 'frontend/**' + # We only run this GitHub action upon new commits to `main` + branches: + - main + - frontend +jobs: + build-and-deploy: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./frontend + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Bun + uses: oven-sh/setup-bun@v1 + + - name: Install + run: bun install + + - name: Build + run: bun run build + + - name: Reparent into dist/frontend + run: cp -r dist frontend/dist + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@4.1.4 + with: + branch: gh-pages + folder: frontend/dist + # Remove previous build files + clean: true + # Do not remove the `.nojekyll` file: we have manually added an empty `.nojekyll` file at the root of the `gh-pages` branch and we don't want having to re-create it after each build. + clean-exclude: | + .nojekyll + CNAME diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 861b04b3..9cbacf8e 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -4,4 +4,5 @@ import react from '@vitejs/plugin-react-swc' // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], + base: "/teamagochi/frontend/" })