Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create 404 link only if real file doesn't exists. #9

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ jobs:
## Options 🔧
| Name | Description | Default | Required |
|:--------:|:--------------------------------:|:--------------:|:--------:|
| username | Your username | - | ✅ |
| reponame | Your repository name | - | ✅ |
| token | Please leave this line unchanged | - | ✅ |
| gitemail | Git commit email | [email protected] | ❌ |
| gitname | Git commit name | CI | ❌ |
| gitmsg | Git commit message | deploy | ❌ |
| cname | Custom domain | - | ❌ |
| useyarn | Use yarn to build | false | ❌ |
| username | Your username | - | ✅ |
| reponame | Your repository name | - | ✅ |
| token | Please leave this line unchanged | - | ✅ |
| branch | Default branch name | main | ❌ |
| cname | Custom domain | - | ❌ |
| gitemail | Git commit email | [email protected] | ❌ |
| gitmsg | Git commit message | deploy | ❌ |
| gitname | Git commit name | CI | ❌ |
| useyarn | Use yarn to build | false | ❌ |
23 changes: 14 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,26 @@ inputs:
token:
description: 'Your Github token'
required: true
branch:
description: 'Default branch name'
required: false
default: 'main'
cname:
description: 'Your custom domain'
required: false
default: 'none'
gitemail:
description: 'Your git commit email'
required: false
default: '[email protected]'
gitname:
description: 'Your git commit name'
required: false
default: 'CI'
gitmsg:
description: 'Your git commit message'
required: false
default: 'deploy'
cname:
description: 'Your custom domain'
gitname:
description: 'Your git commit name'
required: false
default: 'none'
default: 'CI'
useyarn:
description: 'Use yarn to build'
required: false
Expand All @@ -41,12 +45,13 @@ runs:
if [ true == ${{ inputs.useyarn }} ]; then yarn install --frozen-lockfile; else npm ci; fi
if [ true == ${{ inputs.useyarn }} ]; then yarn build; else npm run build; fi
cd dist
ln -s index.html 404.html
[ -f 404.html ] || ln -s index.html 404.html
if [ "none" != ${{ inputs.cname }} ]; then echo '${{ inputs.cname }}' > CNAME; fi
git config --global init.defaultBranch "${{ inputs.branch }}"
git config --global user.email "${{ inputs.gitemail }}"
git config --global user.name "${{ inputs.gitname }}"
git init
git add -A
git commit -m '${{ inputs.gitmsg }}'
git push -f https://${{ inputs.username }}:${{ inputs.token }}@github.com/${{ inputs.username }}/${{ inputs.reponame }}.git master:gh-pages
git push -f https://${{ inputs.username }}:${{ inputs.token }}@github.com/${{ inputs.username }}/${{ inputs.reponame }}.git ${{ inputs.branch }}:gh-pages
shell: bash