From 6ceba5fc83524822fd54a364548092d79ed28d51 Mon Sep 17 00:00:00 2001 From: Xevion Date: Fri, 25 Nov 2022 02:33:45 -0600 Subject: [PATCH] Add GitHub Pages deployment workflow --- .github/workflows/deploy.yml | 38 ++++++++++++++++++++++++++++++++++++ vite.config.ts | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) 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..2a30afc --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,38 @@ +name: deploy +on: [push] +jobs: + build: + name: Deploy 'grain' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: borales/actions-yarn@v3.0.0 + with: + cmd: install # will run `yarn install` command + - uses: borales/actions-yarn@v3.0.0 + with: + cmd: build # will run `yarn build` command + + - name: Upload production-ready build files + uses: actions/upload-artifact@v2 + with: + name: production-files + path: ./dist + deploy: + name: Deploy + needs: build + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: production-files + path: ./dist + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 2b3cd66..3b435ed 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,7 +7,7 @@ export default ({mode }) => { process.env = {...process.env, ...loadEnv(mode, process.cwd())}; return defineConfig({ - base: process.env.NODE_ENV == 'production' ? '/grain' : '', + base: process.env.NODE_ENV == 'production' ? '/grain/' : '/', plugins: [react(), tsconfigPaths()], }) }