From 5c1b0cfef2c62652b6b4a579ef39c86556ee4401 Mon Sep 17 00:00:00 2001 From: Daniele Tentoni Date: Wed, 27 Oct 2021 21:06:30 +0200 Subject: [PATCH 1/9] Silence git warning Add config to init a default branch named main to silence git warning. --- action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index b07c2ad..fbd5516 100644 --- a/action.yml +++ b/action.yml @@ -43,10 +43,11 @@ runs: cd dist ln -s index.html 404.html if [ "none" != ${{ inputs.cname }} ]; then echo '${{ inputs.cname }}' > CNAME; fi + git config --global init.defaultBranch main 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 main:gh-pages shell: bash From 49d2d049fa37dd5dacdf97220ca40895b4bf1e18 Mon Sep 17 00:00:00 2001 From: Daniele Tentoni Date: Wed, 27 Oct 2021 21:09:59 +0200 Subject: [PATCH 2/9] Rename action for publishing. --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index fbd5516..03bed85 100644 --- a/action.yml +++ b/action.yml @@ -1,4 +1,4 @@ -name: 'Vue to Github Pages' +name: 'Vue to Github Pages Daniele Tentoni' branding: icon: 'activity' color: 'blue' From cd9b866a99a24393a0a321dd4756bbc53bd98cce Mon Sep 17 00:00:00 2001 From: Daniele Tentoni Date: Sat, 30 Oct 2021 14:43:41 +0200 Subject: [PATCH 3/9] Restore previous name. --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 03bed85..fbd5516 100644 --- a/action.yml +++ b/action.yml @@ -1,4 +1,4 @@ -name: 'Vue to Github Pages Daniele Tentoni' +name: 'Vue to Github Pages' branding: icon: 'activity' color: 'blue' From 3abe779f0e5e92cce356ae3c8cf74c66446d5118 Mon Sep 17 00:00:00 2001 From: Daniele Tentoni Date: Sat, 30 Oct 2021 14:45:20 +0200 Subject: [PATCH 4/9] Add another input for default branch. --- action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index fbd5516..bfd0110 100644 --- a/action.yml +++ b/action.yml @@ -33,6 +33,10 @@ inputs: description: 'Use yarn to build' required: false default: false + branch: + description: 'Default branch name' + required: false + default: 'main' runs: using: "composite" steps: @@ -43,7 +47,7 @@ runs: cd dist ln -s index.html 404.html if [ "none" != ${{ inputs.cname }} ]; then echo '${{ inputs.cname }}' > CNAME; fi - git config --global init.defaultBranch main + git config --global init.defaultBranch "${{ inputs.branch }}" git config --global user.email "${{ inputs.gitemail }}" git config --global user.name "${{ inputs.gitname }}" git init From d4d79ebbbc3020f5a5e9bd8f1694bcd8c1fca1b9 Mon Sep 17 00:00:00 2001 From: Daniele Tentoni Date: Sat, 30 Oct 2021 14:48:14 +0200 Subject: [PATCH 5/9] Reorder not required inputs --- action.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/action.yml b/action.yml index bfd0110..8bd8914 100644 --- a/action.yml +++ b/action.yml @@ -13,30 +13,30 @@ 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: 'CI@example.com' - 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 default: false - branch: - description: 'Default branch name' - required: false - default: 'main' runs: using: "composite" steps: From b9afa173d3dccb10a758566f2690b623095d8c38 Mon Sep 17 00:00:00 2001 From: Daniele Tentoni Date: Sat, 30 Oct 2021 15:02:07 +0200 Subject: [PATCH 6/9] Update options --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e2cc334..f188a43 100644 --- a/README.md +++ b/README.md @@ -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 | CI@example.com | ❌ | -| 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 | CI@example.com | ❌ | +| gitmsg | Git commit message | deploy | ❌ | +| gitname | Git commit name | CI | ❌ | +| useyarn | Use yarn to build | false | ❌ | From 95d537097f9b7b8e2a75039cac96e84b8aa076a6 Mon Sep 17 00:00:00 2001 From: Daniele Tentoni Date: Sat, 30 Oct 2021 15:08:32 +0200 Subject: [PATCH 7/9] Don't fail on symlink creation failed. --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 8bd8914..ae6e9fb 100644 --- a/action.yml +++ b/action.yml @@ -45,7 +45,7 @@ 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 + ln -s index.html 404.html || true if [ "none" != ${{ inputs.cname }} ]; then echo '${{ inputs.cname }}' > CNAME; fi git config --global init.defaultBranch "${{ inputs.branch }}" git config --global user.email "${{ inputs.gitemail }}" From cf7a11e920e110eff3cd57da2b1314e7da0efa79 Mon Sep 17 00:00:00 2001 From: Daniele Tentoni Date: Sat, 30 Oct 2021 15:18:33 +0200 Subject: [PATCH 8/9] Fix push references. --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 8bd8914..4b730a5 100644 --- a/action.yml +++ b/action.yml @@ -53,5 +53,5 @@ runs: 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 main:gh-pages + git push -f https://${{ inputs.username }}:${{ inputs.token }}@github.com/${{ inputs.username }}/${{ inputs.reponame }}.git ${{ inputs.branch }}:gh-pages shell: bash From 13969d67887a35ffeeb81805046670d72de8f562 Mon Sep 17 00:00:00 2001 From: Daniele Tentoni Date: Thu, 11 Nov 2021 10:47:36 +0100 Subject: [PATCH 9/9] Create 404 link only if real file doesn't exists. Added a check before the creation of the 404.html error page file only if another file doesn't exists. This prevent error when users adopt another solutions. --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index b07c2ad..d26b5c5 100644 --- a/action.yml +++ b/action.yml @@ -41,7 +41,7 @@ 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 user.email "${{ inputs.gitemail }}" git config --global user.name "${{ inputs.gitname }}"