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

Use git worktree in deploy_local #1221

Merged
merged 5 commits into from Feb 14, 2020
Merged

Conversation

jimhester
Copy link
Member

This avoids the need to determine the remote url, as we can reuse the
existing one in the checked out repository.

This also allows us to use deploy_local() in GitHub Actions

This avoids the need to determine the remote url, as we can reuse the
existing one in the checked out repository.

This also allows us to use deploy_local in GitHub Actions
@jimhester
Copy link
Member Author

I now export deploy_local() which we didn't previously. I think this is the right thing to do, it is a useful function and we need to call it for GitHub Actions.

The other benefit to this approach using git worktree is that now we can push to the gh-pages branch without having to setup any secrets or add a DEPLOY_PAT in GitHub Actions, which is nice!

An example workflow file using the changes in this PR is at https://github.com/jimhester/r-actions-test/actions/runs/38247939/workflow#L27-L31

@jimhester
Copy link
Member Author

We need to double check that these changes don't break deploy_site_github(), but I believe they will be OK.

R/deploy-site.R Show resolved Hide resolved
R/deploy-site.R Show resolved Hide resolved
Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now just needs a news bullet, I think.

@jimhester
Copy link
Member Author

Ok added two news bullets about the new function and deprecating the repo_slug argument.

@hadley hadley merged commit a78e04c into r-lib:master Feb 14, 2020

github_clone(dest_dir, repo_slug, host)
git("fetch", "origin", branch)
github_worktree_add(dest_dir)
Copy link
Contributor

@Bisaloo Bisaloo Feb 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be completely wrong here but shouldn't this be:

github_worktree_add(dest_dir, branch = branch)

?

We're getting an error when trying to deploy from travis with the dev version of pkgdown:

Error in git("worktree", "add", "--track", "-b", branch, dir, paste0("origin/", :

argument "branch" is missing, with no default

Complete log: https://travis-ci.org/rmaia/pavo/jobs/651466810

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right @Bisaloo, should be fixed by aceba8b

Copy link
Contributor

@sumedh10 sumedh10 Feb 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change now throws the following error when travis tries to deploy on enterprise github

Running git worktree add --track -b gh-pages /tmp/Rtmp8zQQdq/file598365058050
origin/gh-pages
Preparing worktree (new branch 'gh-pages')
error: the requested upstream branch 'origin/gh-pages' does not exist
...
...
...
Error: System command 'git' failed, exit status: 255, stdout & stderr were printed

Btw, gh-pages branch does exist on our repos.

jimhester added a commit that referenced this pull request Feb 17, 2020
A mistake introduced after refactoring

Fixes a78e04c
Fixes #1221 (review)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants