Giter Club home page Giter Club logo

jamesives / github-pages-deploy-action Goto Github PK

View Code? Open in Web Editor NEW
4.1K 19.0 346.0 73.22 MB

πŸš€ Automatically deploy your project to GitHub Pages using GitHub Actions. This action can be configured to push your production-ready code into any branch you'd like.

Home Page: https://github.com/marketplace/actions/deploy-to-github-pages

License: MIT License

HTML 0.80% TypeScript 95.94% JavaScript 3.26%
github-actions github-action gh-pages github-pages deployment deployer cicd ghpages deploy workflow

github-pages-deploy-action's Introduction

github-pages-deploy-action's People

Contributors

andipaetzold avatar anushbhatia avatar bananer avatar ben-z avatar dependabot-preview[bot] avatar dependabot[bot] avatar exuanbo avatar fredefox avatar garazdawi avatar germa89 avatar harryzcy avatar hemberger avatar iam-afvincent avatar jaiselrahman avatar jakejarvis avatar jamesives avatar kindeep avatar lambertschulze avatar lucassabreu avatar lycuid avatar mathiasbynens avatar mpickering avatar nickmccurdy avatar nomeata avatar pheeel avatar rikhuijzer avatar rossjrw avatar sanchom avatar sojinsamuel avatar verhovsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

github-pages-deploy-action's Issues

Workspace should return to normal after deployment

Describe the bug

After the deployment, I think that the repo needs to be left exactly as it was before. Right now there is some discrepancy that can cause problems in subsequent steps.

Reproduce

In my case I'm looking a particular folder, before and after the deployment, and seeing a difference. The workflow is here. The evidence of the discrepancy is in the Github Actions output here. Compare the sections "scripts folder before deploy" and "scripts folder after deploy".

Expected behavior

In the example above, the output of "scripts folder before deploy" and "scripts folder after deploy" should be the same.

Additional Comments

The failure in that linked workflow shows an example of how this can cause a problem. In this case, it's preventing the official "cache" action's "Post" step from working.

Replace BASE_BRANCH default with GITHUB_SHA

Is your feature request related to a problem? Please describe.

Please provide a clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I don't think we should be forcing master as the default if BASE_BRANCH is not included.

Describe the solution you'd like

Please provide a clear and concise description of what you want to happen.

I think it would make more sense to use the GITHUB_SHA variable as the default if it's available, and then default to master. For the majority of deployments this means you'll no longer have to unnecessarily specify BASE_BRANCH if you want to run a deployment off of the same branch that you're committing to.

Additional Comments

Add any other context or screenshots about the feature request here.

Part of 3.1.1.

`CLEAN: true` not working

I am currently building documentation for time-rs/time and publishing using this action. In the relevant workflow, I set CLEAN: true as indicated by the README. However, the history still persists (see the commits for the gh-pages branch).

Am I doing something wrong here?

Build error: spawn rsync ENOENT

Describe the bug
I am trying to generate static html and then deploy it to the gh-pages branch. I am getting the following error:

There was an error when attempting to execute the process 'rsync'. This may indicate the process failed to start. Error: spawn rsync ENOENT

Reproduce
The error occurs when I open a pull request from master into release with the following build script:

name: .NET Core

on: 
  push:
    branches: 
      - "release"
  pull_request:
    branches: 
      - "release"

jobs:
  build:
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v1
    
    - name: Setup .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 3.0.100
    
    - name: Install DocFX
      run: choco install docfx

    - name: Generate static documentation with DocFX
      run: docfx build docs/docfx.json
      
    - name: Deploy documentation to gh-pages branch
      uses: JamesIves/github-pages-deploy-action@releases/v3
      with:
        ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
        BASE_BRANCH: release
        BRANCH: gh-pages
        FOLDER: docs/_site

Expected behavior
No errors, successful deployment.

Screenshots
image

Additional Comments
Link to this run and the error: https://github.com/LeMorrow/APOD.Net/pull/31/checks?check_run_id=318371187#step:6:24

Note that I am using Windows, which I have to do in order to install DocFX.

pathspec 'release' did not match any file(s) known to git

Describe the bug
Hello again πŸ™‚
Today I finished up my CI/CD workflow fully and everything was working great (ignore errors in other jobs). I develop on master branch and pull request into release branch, which triggers the workflow when merged (on push). However, this was always adding one merge commit to the release branch, which I thought didn't look very good. So instead of doing that, I did a git rebase master from my release branch and pushed. This worked fine on the first deploy.

However, on my next deploy I got the following error:

pathspec 'release' did not match any file(s) known to git

I saw #72 but since I am running v3 I don't think the fix applies to me.

Reproduce

I will test this tomorrow but this should reproduce it. Sorry that it's very long and untested, I'll follow up ASAP on minimum steps to repro.

  1. Create a public repo
  2. Create a branch release
  3. Commit my workflow file on the master branch
  4. Pull request into release (should succeed)
  5. Perhaps make another commit on master and PR to release just to make sure
  6. Make a commit on master, switch to release and run git rebase master and then git push (should succeed, I think)
  7. Repeast step 6 and now it should fail (even if you pull reuqest instead of rebasing)

Expected behavior
It should not give me the error and probably switch to the release branch, because it exists.

Screenshots
For what it's worth, the network graph also seems to think that my old release branch is different from my new one after the rebasing in the middle.
image

Additional Comments
Note to self: don't rebase like that.

Deploying to GitHub fails with git error

Describe the bug

Deploying to GitHub Pages fails at the end with:

Deploying to GitHub...
1/2 (0)
2/2 (1)
error: src refspec ***@github.com/myusername/myrepo.git does not match any.
error: failed to push some refs to 'https://'
##[error]Docker run failed with exit code 1

Reproduce

My (simplified) workflow looks something like this:

name: CI
on: push
jobs:
  jsdoc:
    name: Publish Docs
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - uses: JamesIves/github-pages-deploy-action@master
        env:
          ACCESS_TOKEN: ${{ secrets.GH_PAGES_ACCESS_TOKEN }}
          BASE_BRANCH: dev
          BRANCH: gh-pages
          FOLDER: docs
          BUILD_SCRIPT: npm install && npx jsdoc -c jsdoc.conf.json

Expected behavior

The workflow step should succeed by publishing the docs folder to GitHub Pages.

Proposal: Preventing Interruption

As the master branch of this repo has been advertised in the README instructions for so long, it's likely that releasing v3 will cause a lot of peoples deployment scripts to cease working. I want people to adopt version 3, but I don't want to cause problems for a lot of people.

For the version 3 launch I'm proposing moving away from using master as the base branch, in favor of something such as dev, and then having each version have its own releases/v2 and releases/v3 branch, so they can be referenced in the action yml file using JamesIves/github-pages-deploy-action@releases/v3 etc.

Here's the outline of the proposal:

  • Create a branch off of master called dev. This will act as the new "master" branch.
  • Leave master alone permanently as the version 2 script.
  • Create a releases/v2 branch from master for semantic purposes.
  • Make one final pull request to master that includes a print statement in the log, asking people to migrate either to releases/v2 or releases/v3.

I've already updated the README in the master branch to indicate to users that they should put releases/v2 in their action yml.

Support actions/checkout@v2

Currently this action requires you to use actions/checkout@v1 instead of the latest release. This should be investigated so v2 is also supported without causing any breaking changes.

My guess is it’s related to the token config persistence. It’s likely that the GITHUB_TOKEN variable is being included automatically by the action which is causing some funky behavior in subsequent builds. I can investigate this more when I get home, I think we may need to change the variable name for GITHUB_TOKEN.

Originally posted by @JamesIves in #98

File Already Exists .git

Describe the bug

Please provide a clear and concise description of what the bug is.

With version 3 if you attempt to deploy the parent directory using . as the FOLDER name, you end up getting an error message as it tries to copy over the .git folder.

##[error]EEXIST: file already exists, mkdir '/home/runner/work/doughnut-generator/doughnut-generator/temp-deployment-folder/.git'

Reproduce

Steps to reproduce the behavior.

Use . as the FOLDER env variable.

Expected behavior

Please provide a clear and concise description of what you expected to happen.

This shouldn't error the process, and . should be able to be used.

Option for target directory

Is your feature request related to a problem? Please describe.

I have a lot of output files from my builds (~150 images) that I'd like to deploy to a subdirectory, e.g. assets/cards/. Currently, if I specify my output folder, it copies all 150 images to the root of the repository.

To work around this at the moment, I specify FOLDER: . and move my images in my source repo. But I'd rather not copy my entire repo over to the gh-pages target - just this folder.

Describe the solution you'd like

An option, say, DEST_FOLDER that specifies the destination on the ghpages branch. For backward compatibility, it could default to .

Additional Comments

This is a non-blocking issue for me, but it would be nice.

Love this action! Thank you for doing it.

Add JavaScript to the name

Is your feature request related to a problem? Please describe.
Currently, this action allows to run JavaScript build comands during the deployment. In my opinion, this action should rather just focus on actually deploying. If it's necessary to build something in the process, that should be an extra step.

Describe the solution you'd like
No longer use the node:10 docker container. In fact: don't use docker at all. Just run the necessary git commands to push the changes to the specified branch.

Additional Comments
This change would also allow to have a single action that builds every time, but only deploys when the branch is master by using jobs.<job_id>.steps.if.

Improve commit message

Is your feature request related to a problem? Please describe.

The commit messages look like Deploying to gh-pages - 12:46:39. The time is not useful as commits already have a time associated with them and the time is wrong for timezones that are non-GMT.

Describe the solution you'd like

Ideally the commit message would reference the commit from the source branch:
git commit -m "Deployed from $BASE_BRANCH - $GITHUB_SHA"

Cannot push to newly created gh-pages branch

Description:

Something is going wrong with the git commands of the releases/v3 action. Specifically I am receiving the following error:

fatal: invalid reference: origin/gh-pages

Context:
I am slowly getting around to upgrading all my deployments to v3 and encountered an unusual bug. To fully reset everything, I deleted the gh-pages branch from my repo and then switched over the deployment code to v3. Commit one here, Commit two here.

Focusing on the second commit after I had realized I had made a mistake, it produced this log.

Happy to rerun the action or try things on my side just very confused by the bug since it seems to be a git failure but not sure how to solve considering the git command is being run by the github-pages-deploy-action itself.

Action's Docker Container will sometimes "exit early"

Describe the bug

I use this in conjunction with Gatsby to generate a fairly large (well markdown file size) github pages website.

The build itself works fine, and it will suddenly exit with a 128 while pushing files to github.

Reproduce

It's only sometimes after I push changes. It's been every other run so far. I have logs, but they don't have what I need to diagnose.

Expected behavior

To not get cut off while uploading.

Screenshots

https://github.com/Rangoric/rangoric.github.io/actions

The repo is public, I am not sure if actions are readable by the public. If not, let me know.

Additional Comments

I don't think this is an issue on your end, but I've seen it twice, and the logs never give me what the actual issue is, it just stops mid push so am hoping for ideas.

Also, this is a personal project so not critical, but also means I can test / help with any changes needed to troubleshoot this. If the site goes down I'm the only one that would notice.

When it works, it works perfectly.

Can I support deployment to other repositories?

Yes, I now have a private repository hosting the blog source files, but deploying github pages is in another repository. Can I support this?

Thanks a lot for this tool to help me automate the deployment of online documentation for open source projects.

Add a Test

It would be a good idea to have a "test" workflow that pushes up a static page to the gh-pages branch on each deployment to ensure the working state of the action.

Document ACCESS_TOKEN required scope

Is your feature request related to a problem? Please describe.

There is no information about the required scope for the ACCESS_TOKEN.

Describe the solution you'd like

Describe which parts of the scope are needed.

3.0 Allow to clean up existing files in target branch

Is your feature request related to a problem? Please describe.

Some frameworks generate js files with a content hash, to provide better cache management. Since all existing files are left intact on the target branch, this means that the target branch will only increase in size.

Now I'm aware an option would be to disable content hash tags, but it also applies to files that are no longer needed.

Would it be possible to add a flag to have this action clean up files that no longer exist in the source folder?

Describe the solution you'd like

Ideally, instead of copying over the source folder on top of the target branch, a rsync with a delete option so that files that no longer exist in the source folder are removed from the branch

Additional Comments

N/A

pipeline completed successful but no change are visible

Describe the bug
Hi there,
I'm experiencing a weird behaviour with gatsby blog, gh-pages and github actions. Pretty much despite it deploy I'm not able to see the changes.

These are the steps I performed:

  • I created my workflow/main.yml file as described on the doc:
name: Build and Deploy
on:
  push:
    branches:
      - develop
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@master

      - name: Build and Deploy
        uses: JamesIves/github-pages-deploy-action@master
        env:
          ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
          BASE_BRANCH: develop
          BRANCH: master
          FOLDER: public
          BUILD_SCRIPT: npm install && npm run-script build

If instead, I run from my machine: npm run deploy: https://github.com/daniele-zurico/daniele-zurico.github.com/blob/develop/package.json
Everything works as expected.

Can someone tell me what I'm doing wrong, please?

Support building without deploying

Is your feature request related to a problem? Please describe.

Seems from action that the action can only deploy, and can't build without deploying. This is useful when there are tests to be run before deploy, such as the html-proofer gem that does a bunch of checks for valid html.

Describe the solution you'd like

I'd love for a SKIP_DEPLOY flag, so that I can create a test workflow that has an additional step of my own for running a custom script on the build website. This would run in pull requests.

Additional Comments

Thanks so so much for offering this action, and any consideration you might give this :)

Check to see if the remote exists first

Is your feature request related to a problem? Please describe.

Please provide a clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Right now users have to create the gh-pages branch themselves, this isn't ideal.

Describe the solution you'd like

Please provide a clear and concise description of what you want to happen.

The action should check to see if the remote exists prior to deploying. If it doesn't exist it should create it.

Docker run failed with exit code 1

Describe the bug

https://github.com/vhoyer/timedReport

...
Setting up libjq1:amd64 (1.5+dfsg-1.3) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Setting up jq (1.5+dfsg-1.3) ...
Reinitialized existing Git repository in /github/workspace/.git/
Switched to a new branch 'master'
Branch master set up to track remote branch master from origin.
Running build scripts... 
Deploying to GitHub...
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
Docker run failed with exit code 1

Reproduce

name: Build and Deploy
on:
  push:
    branches:
      - master
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1

    # https://github.com/marketplace/actions/deploy-to-github-pages
    - name: Deploy to GitHub Pages
      uses: JamesIves/github-pages-deploy-action@master
      env:
        ACCESS_TOKEN: ${{ secrets.GH_PAGES_DEPLOY_ACCESS_TOKEN }}
        BASE_BRANCH: master
        BRANCH: gh-pages # The branch the action should deploy to.
        FOLDER: src # The folder the action should deploy.

Folder struct:

.
β”œβ”€β”€ package.json
β”œβ”€β”€ package-lock.json
└── src
    β”œβ”€β”€ components
    β”‚Β Β  β”œβ”€β”€ card.js
    β”‚Β Β  β”œβ”€β”€ context.css
    β”‚Β Β  β”œβ”€β”€ context.js
    β”‚Β Β  └── my-footer.js
    β”œβ”€β”€ css.css
    β”œβ”€β”€ index.html
    β”œβ”€β”€ js.js
    └── resources
        └── body-bg.svg

Expected behavior

Deploy to gh pages

Additional Comments

logs_10.zip

Integration Test Should Run on Schedule

Is your feature request related to a problem? Please describe.

Please provide a clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Right now the integration test runs on every commit to master. If there's an API change on Github's end, or something similar, this might go uncaught for some time.

Describe the solution you'd like

Please provide a clear and concise description of what you want to happen.

To combat this the integration test should be updated to run on a schedule. That way we can be sure that it's correctly performing the task.

Additional Comments

Add any other context or screenshots about the feature request here.

I'm going to setup a test for this in another repo, and should it be successful I'll move it over to the integration test here.

Issue with rsync and build file path

Describe the bug

Please provide a clear and concise description of what the bug is.

While the action is processing, everything goes fine until near the end of the process it says:

rsync: change_dir "/home/runner/work/documentation/documentation//build" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]
The deployment encountered an error. ❌
##[error]The process 'rsync' failed with exit code 23

Similar to issue #84

Reproduce

Steps to reproduce the behavior.

I'm not sure the exact steps to reproduce this, but my workflow files can be found here: πŸ”—

Expected behavior

Please provide a clear and concise description of what you expected to happen.

I expected it to move into the folder .../documentation/build then deploy as expected

Screenshots

If applicable, add screenshots to help explain your problem.

Error is same as #84 but I can provide screen shots if necessary, too.

Additional Comments

Add any other context about the problem here.

Feature request: preserve history of gh-pages

Is your feature request related to a problem? Please describe.

In my company we have recently switched from Wordpress to Jekyll for a series of reasons, and one of them was to have version control of our blog / homepage / comercial website.

We have enjoyed using your action in the last step of our build pipeline, however we wanted to preserve the history of gh-pages between deploys and ultimately switched to another Github Action that does that and is smart enough to avoid a deployment if nothing changed.

Describe the solution you'd like

Since your action is actively maintained, I though you might be interested in adding that funcionality based on the other mentioned action that is less maintained.

Additional Comments

The end result of having full version control of gh-pages branch is great! We can even compare visually the history of our blog locally by moving between commits.

3.0 Git reinitalization error, build continues

Describe the bug

During a scheduled run of my workflow an error is generated during the git init step, however, the build itself continues to run just fine.

The log of the run can be seen here: https://github.com/eve-lore/gallente-elections/runs/314791864

Reproduce

See link above

Expected behavior

While I'm not sure if that would have actually been an error (I also cannot see where it was actually triggered), I would likely expect it to be either ignored, or aborted.

Screenshots

See link above.

Additional Comments

N/A

error: unknown option `---END'

Describe the bug

Please provide a clear and concise description of what the bug is.
https://github.com/Kok-Kip/frontend/blob/master/.github/workflows/nodejs.yml
this is my workflow and I failed to push my docs/ folder to my gh-pages branches for github pages deployment
Reproduce

Steps to reproduce the behavior.

Expected behavior

Please provide a clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional Comments

Add any other context about the problem here.

Build fails if deploy files aren't new

Describe the bug

If the action is ran and no deploy file has changed the build will fail.

Reproduce

  • Create a workflow with this action using releases/v3 that triggers on push
  • Push something unrelated to the deploy (for example a change in README)
  • The ci will fail

Expected behavior

The build doesnt fail or Im able to tell the action to not fail on clean git trees (however i think it should be the default)

Screenshots

image

on.push.branches and env.BASE_BRANCH are redundant

Describe the bug

The readme uses on.push.branches set to master as an example, but pushing to other branches doesn't deploy them anyway because of env.BASE_BRANCH defaulting to master.

Expected behavior

I think it would be less confusing and easier to change the base branch if we either removed the env.BASE_BRANCH config to deploy all matching branches or removed on.push.branches from the configuration (has the disadvantage of taking extra time to build other branches).

Branch deleted after "deploy"

Describe the bug

Action creates gh-pages branch, pushes the desired files to it, but then deletes it again after assertion failed: test FOLDER = FODER

Reproduce

My workflow yaml

Expected behavior

That the gh-pages branch will not be deleted at the end of the deployment

Screenshots / Logs

Logs

Additional Comments

The files pushed to the branch seem correct to me. The first weird log entry to me is

assertion failed: test Breadstone.Blazor/bin/Release/netstandard2.0/publish/Breadstone.Blazor/dist = ./Breadstone.Blazor/bin/Release/netstandard2.0/publish/Breadstone.Blazor/dist

Solution

This led me to believe, that the ./ in my FOLDER path led to this problem, which is what was the case. So maybe this can be put into the documentation, or maybe the action can be able to accept leading ./

Fix Unit Tests

Describe the bug

Please provide a clear and concise description of what the bug is.

Unit tests and integration tests are failing due to some incorrect setup, this should be fixed.

GitHub Pages build failed

What's the problem?

Every time an action is triggered, I get the "Your site is having problems building: Page build failed." error.

I tried to replace GITHUB_TOKEN: ${{ secret.GITHUB_TOKEN }} with ACCESS_TOKEN: ${{ secret.REPO_SCOPED_TOKEN }}.

Didn't help.

I tried to add a .nojekyll file to the build.

Didn't help.

I tried using JamesIves/github-pages-deploy-action@releases/v3.

Didn't help.

I tried to add a .nojekyll file directly to gh-pages branch.

But,

You can safely commit these files directly into deployment branch without them being overridden after each deployment

is definitely not true. All files are erased every time.

Expected behavior

No errors will occur after deployment.

Therefore, I would appreciate any help in solving this problem.

Improve the integration tests

It would be great to improve the integration test page that is deployed so it provides more details on how to install the action, and a list of contributors to the action. It would be really cool to model it based on this page: https://github.com/features/actions

It would also be good to improve the integration tests, adding more variations into the mix to see which ones fail/pass to make sure the action stays in tip-top condition.

Add .nojekyll support

Please, add support for adding .nojekyll file to gh-pages branch. Also, consider #37:

uses: JamesIves/github-pages-deploy-action@master
with:
  nojekyll: true
  # ...

Fatal authentication error during build

Describe the bug

GitHub action step fails and logs this error:
fatal: could not read Password for 'https://***@github.com': No such device or address

Reproduce
I am using this configuration for the action in my workflow.yml:

name: Build & Jekyll

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Setup ruby
        uses: actions/setup-ruby@v1
        with:
          ruby-version: '2.6'
          architecture: 'x64'
      - name: Setup node
        uses: actions/setup-node@v1
        with:
          node-version: 10
      - run: npm install
      - name: Jekyll build
        uses: JamesIves/github-pages-deploy-action@master
        env:
          ACCESS_TOKEN: ${{secrets.GH_AUTH_TOKEN}}
          BRANCH: master
          FOLDER: "."
          CNAME: template.itwcreativeworks.com

And I have double checked that my GitHub access token is stored as a secret named GH_AUTH_TOKEN.

Expected behavior

Should build without an error

Allow pushing/deploying to protected branches

Describe the bug

If the deploy branch is protected, the deploy fails with the following error: remote: error: Cannot force-push to a protected branch .

Can we allow pushing to protected branches?

Version 3.0.0

Version 3.0.0

I'm currently working on the next iteration of this action, here are the proposed changes.

  • The action will be re-written using the Action Toolkit API using TypeScript. The reason for this change is simply due to better testing, and because GitHub actions seem to be going more in this direction.
  • The action will no longer build projects. With the changes to the actions API it's much easier to simply add a build step before the action runs. It's a bit pointless to have a supported step in the process that is specifically for Node based projects. As it's more agnostic the idea is that it can now support any form of framework/env.
  • The action will utilize with instead of env and will now error straight off the bat if there's something missing.

Progress

I'm hoping to have most of this work wrapped up this week.

  • Re-write core functionality using the action using the actions/toolkit API.
  • Make it so the action uses the with case in the workflow file.
  • Add a .nojekyll flag.
  • Write the branch creation functionality using the actions/toolkit API.
  • Write unit tests.
  • Automate the deployment.
  • Create a releases/v2 branch so legacy versions can continue to work.
  • Add dev tooling so the code remains consistent.
  • Verify that the action works correctly with the proposed changes.

Wrong path used for rsync

Describe the bug

Fails to run because it's lookin in the wrong folder. When specifying build it tries to look in
/home/runner/work/tarkov-tools/tarkov-tools//build for my repo tarkov-tools

rsync: change_dir "/home/runner/work/tarkov-tools/tarkov-tools//build" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]

Reproduce

name: Build and Deploy
on: [push]

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    
    steps:
    - name: Checkout
      uses: actions/checkout@v1

    - name: Build and Deploy
      uses: JamesIves/github-pages-deploy-action@releases/v3
      with:
        ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
        BASE_BRANCH: master # The branch the action should deploy from.
        BRANCH: gh-pages # The branch the action should deploy to.
        FOLDER: build # The folder the action should deploy.
        CLEAN: true

Expected behavior

Actually works :D

Additional Comments

Full log:

Run JamesIves/github-pages-deploy-action@releases/v3
  with:
    ACCESS_TOKEN: ***
    BASE_BRANCH: master
    BRANCH: gh-pages
    FOLDER: build
    CLEAN: true
git init
Reinitialized existing Git repository in /home/runner/work/tarkov-tools/tarkov-tools/.git/
git config user.name kokarn
git config user.email [email protected]
git ls-remote --heads https://***@github.com/kokarn/tarkov-tools.git gh-pages | wc -l
955e534a3ab92c619b3a5502097c134ca4e809dd	refs/heads/gh-pages
git checkout master
Switched to a new branch 'master'
Branch 'master' set up to track remote branch 'master' from 'origin'.
git fetch https://***@github.com/kokarn/tarkov-tools.git
From https://github.com/kokarn/tarkov-tools
 * branch            HEAD       -> FETCH_HEAD
git worktree add --checkout gh-action-temp-deployment-folder origin/gh-pages
Preparing worktree (detached HEAD 955e534)
HEAD is now at 955e534 Updates
rsync -q -av --progress build/. gh-action-temp-deployment-folder --delete --exclude CNAME --exclude .nojekyll --exclude .git --exclude .github
rsync: change_dir "/home/runner/work/tarkov-tools/tarkov-tools//build" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]

Might be worth noting that it seems /build "works" but also looks in the wrong folder OFC

Run JamesIves/github-pages-deploy-action@releases/v3
  with:
    ACCESS_TOKEN: ***
    BASE_BRANCH: master
    BRANCH: gh-pages
    FOLDER: /build
    CLEAN: true
##[error]The deployment folder cannot be prefixed with '/' or './'. Instead reference the folder name directly.
git ls-remote --heads https://***@github.com/kokarn/tarkov-tools.git gh-pages | wc -l
955e534a3ab92c619b3a5502097c134ca4e809dd	refs/heads/gh-pages
git checkout master
Switched to a new branch 'master'
Branch 'master' set up to track remote branch 'master' from 'origin'.
git fetch https://***@github.com/kokarn/tarkov-tools.git
From https://github.com/kokarn/tarkov-tools
 * branch            HEAD       -> FETCH_HEAD
git worktree add --checkout gh-action-temp-deployment-folder origin/gh-pages
Preparing worktree (detached HEAD 955e534)
HEAD is now at 955e534 Updates
rsync -q -av --progress /build/. gh-action-temp-deployment-folder --delete --exclude CNAME --exclude .nojekyll --exclude .git --exclude .github
rsync: change_dir "/build" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]
##[error]The process 'rsync' failed with exit code 23
Completed Deployment
##[error]Node run failed with exit code 1

Deployment fails if BRANCH already exists on remote

Describe the bug

Please provide a clear and concise description of what the bug is.

I have developed a portfolio website of mine which I want to host on github pages at https://sudkumar.github.io/. My development branch is src and the master branch should contain the website code (build folder). I have integrated the actions and it worked for the first deployment and created a master branch from my build folder (here). But when deploying again (now the master branch already exists on remote), the deployment deletes the master branch without creating it again (here). And this happens for all alternate deployments.

It throws this error.

Deploying to GitHub...
Error: Use --prefix instead of bare filenames.
To https://github.com/sudkumar/sudkumar.github.io.git
 - [deleted]         master
Deployment succesful!

Reproduce

Steps to reproduce the behavior.

Please have a look at my deployment actions

Expected behavior

Please provide a clear and concise description of what you expected to happen.

I expect it to push the new deployment to the master branch with the new commit.

Work Around
I have created a step to delete the master branch before the deployment step.

https://github.com/sudkumar/sudkumar.github.io/blob/5e166f27170660561d48156fd45498b627ec40ae/.github/workflows/deploy.yml#L16-L23

Please let me know if you need more details or I can be of some help in resolving this issue.

Additional Issue Templates

It would be nice to have an additional issue templates.

  • Improve feature template.
  • Improve bug template.
  • Add support template.

private repository fatal error: could not read Username

Describe the bug

When deploying my static site to GitHub Pages, it works if the repository is public but as soon as I switch over to private it's throwing a bunch of issues.

Reproduce

The demo repository is here: https://github.com/tao/jigsaw-deploy-bug

Expected behavior

I was working on this issue for a while and figured out it disappeared on my test repository when it was public, but these issues come up when made private, the issue thrown is:

Run JamesIves/github-pages-deploy-action@releases/v3
  with:
    ACCESS_TOKEN: ***
    BASE_BRANCH: master
    BRANCH: gh-pages
    FOLDER: build_production
Reinitialized existing Git repository in /home/runner/work/jigsaw-deploy-bug/jigsaw-deploy-bug/.git/
git config user.name tao
git config user.email [email protected]
git ls-remote --heads https://***@github.com/tao/jigsaw-deploy-bug.git gh-pages | wc -l
49f0c117cd645d02e0a4feecde33e81223cadb38	refs/heads/gh-pages
git checkout master
Switched to a new branch 'master'
M	source/assets/build/css/main.css
M	source/assets/build/js/main.js
M	source/assets/build/mix-manifest.json
Branch 'master' set up to track remote branch 'master' from 'origin'.
git fetch origin
fatal: could not read Username for 'https://github.com': No such device or address
##[error]The process 'git' failed with exit code 128
Completed Deployment
##[error]Node run failed with exit code 1

I've tried this with GITHUB_TOKEN and ACCESS_TOKEN and the errors are a bit different, with GITHUB_TOKEN the response is:

Run JamesIves/github-pages-deploy-action@releases/v3
  with:
    ACCESS_TOKEN: ***
    BASE_BRANCH: master
    BRANCH: gh-pages
    FOLDER: build_production
git init
Reinitialized existing Git repository in /home/runner/work/jigsaw-deploy-bug/jigsaw-deploy-bug/.git/
git config user.name tao
git config user.email [email protected]
git ls-remote --heads https://***@github.com/tao//jigsaw-deploy-bug.git gh-pages | wc -l
fatal: could not read Password for 'https://***@github.com': No such device or address
##[error]The process 'git' failed with exit code 128
Completed Deployment
##[error]Node run failed with exit code 1

Additional Comments

It's my first time using GitHub Actions and Github Pages, so there could be something small I'm missing but it would be great if I could run this from a private repo.

The permissions given to ACCESS_TOKEN are [repo:all] and [read:public_key]

Error: Input required and not supplied: FOLDER

Describe the bug

Run JamesIves/github-pages-deploy-action@releases/v3
/home/runner/work/_actions/JamesIves/github-pages-deploy-action/releases/v3/node_modules/@actions/core/lib/core.js:69
        throw new Error(`Input required and not supplied: ${name}`);
        ^

Error: Input required and not supplied: FOLDER
    at Object.getInput (/home/runner/work/_actions/JamesIves/github-pages-deploy-action/releases/v3/node_modules/@actions/core/lib/core.js:69:15)
    at Object.<anonymous> (/home/runner/work/_actions/JamesIves/github-pages-deploy-action/releases/v3/lib/constants.js:14:23)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/home/runner/work/_actions/JamesIves/github-pages-deploy-action/releases/v3/lib/git.js:22:21)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
##[error]Node run failed with exit code 1

https://github.com/njzjz/njzjz.github.io/runs/310999897#step:9:11

Reproduce

    - name: Deploy to GitHub Pages
      uses: JamesIves/github-pages-deploy-action@releases/v3
      if: github.ref == 'refs/heads/hexo'
      env:
        ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
        BASE_BRANCH: hexo
        BRANCH: master
        FOLDER: public

Expected behavior

run successfully

Screenshots

Additional Comments

Create any specified BASE_BRANCH if it does not exists

Is your feature request related to a problem? Please describe.

I would like to be able to provide a "template repository" that would allow non-technical users to quickly create a repo and have GitHub pages deployments working without much trouble. The problem is that for brand new repos, only the default branch exists - so there is no "gh-pages" branch. So users have to create that branch manually.

Right now the BRANCH does get created if it does not exist. But if BASE_BRANCH does not exist, the step fails.

Describe the solution you'd like

If the BASE_BRANCH does not exist, I would like this step to create it.

error: pathspec 'master' did not match any file(s) known to git

Describe the bug

Deploy fails when trying to checkout master branch:

error: pathspec 'master' did not match any file(s) known to git

I confirm that the repo is public and the master branch actually exists: https://github.com/qtoggle/qui/tree/master.

Reproduce

It's a public repo and here's a link to the failed run: https://github.com/qtoggle/qui/runs/332062186.

Does the command run in the correct folder?

Expected behavior

The git checkout master command should actually checkout the master branch and the deployment should carry on.

Screenshots

If applicable, add screenshots to help explain your problem.
image

fatal 'src' could be both a local file and a tracking branch.

git ls-remote --heads https://***@github.com/sudkumar/sudkumar.github.io.git master | wc -l
068dab7e7778d41ef7391d733959ef0af48e2c6b	refs/heads/master
git checkout src
fatal: 'src' could be both a local file and a tracking branch.
Please use -- (and optionally --no-guess) to disambiguate
##[error]The process 'git' failed with exit code 128
Deployment Successful!
##[error]Node run failed with exit code 1

Deployment

Logs
Run JamesIves/github-pages-deploy-action@releases/v3-beta
git init
Reinitialized existing Git repository in /home/runner/work/sudkumar.github.io/sudkumar.github.io/.git/
git config user.name sudkumar
git config user.email [email protected]
git ls-remote --heads https://***@github.com/sudkumar/sudkumar.github.io.git master | wc -l
068dab7e7778d41ef7391d733959ef0af48e2c6b	refs/heads/master
git checkout src
fatal: 'src' could be both a local file and a tracking branch.
Please use -- (and optionally --no-guess) to disambiguate
##[error]The process 'git' failed with exit code 128
Deployment Successful!
##[error]Node run failed with exit code 1
Workflow
name: Build and Deploy
on:
  push:
    branches:
      - src
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@master

      - name: Use Node.js
        uses: actions/setup-node@v1

      - name: Install
        env:
          CI: true
        run: |
          npm ci

      - name: Semantic Release
        uses: cycjimmy/semantic-release-action@v2
        id: semantic # Need an `id` for output variables
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: 000000000000000

      - name: Build
        env:
          CI: true
        run: |
          npm run-script build

      - name: Deploy
        uses: JamesIves/github-pages-deploy-action@releases/v3-beta
        with:
          ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
          BASE_BRANCH: src # The branch the action should deploy from.
          BRANCH: master # The branch the action should deploy to.
          FOLDER: public # The folder the action should deploy.
          BUILD_SCRIPT: npm run-script build # The build script the action should run prior to deploying.
          COMMIT_NAME: Sudhir Mitharwal

Originally posted by @sudkumar in #43 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.