This Action will Build your Vue Project and deploy it to Github Pages
- For Vue 2 : Create the
vue.config.js
file - For Vue 3 : You should have a
vite.config.js
or avite.config.ts
file at the root of your directory. Create one if you don't.
- For Vue 2 : Add this to your
vue.config.js
(and rename "YourRepoName" to your repo name)
module.exports = {
publicPath: '/YourRepoName/'
}
- For Vue 3 : Add this to you
vite.config.js
orvite.config.ts
(and rename "YourRepoName" to your repo name)
export default defineConfig({
... // Already existing configurations
base: '/YourRepoName/'
});
If project has CNAME file, steps 1 and 2 ignore
- Create a Github Actions Workflow file and add this to it (and replace "YourGithubName" and "YourRepoName" with the names)
name: Build Vue
on: [push]
jobs:
build_vue:
runs-on: ubuntu-latest
name: Build Vue
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Vue App to Github Pages
uses: StruggleYang/[email protected]
with:
useyarn: true # if project is npm build ,set false
- Go to
Settings
-> Scroll down toPages
-> Select Source asGitHub Actions
Name | Description | Default | Required |
---|---|---|---|
cname | Custom domain | - | ❌ |
useyarn | Use yarn to build | true | ❌ |