mirror of
https://github.com/Xevion/grain.git
synced 2025-12-05 23:15:08 -06:00
Add GitHub Pages deployment workflow
This commit is contained in:
38
.github/workflows/deploy.yml
vendored
Normal file
38
.github/workflows/deploy.yml
vendored
Normal file
@@ -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
|
||||
@@ -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()],
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user