appleboy / appleboy/drone-git-push

[Docs] Commit and push only subdir to another branch (GitHub/CodeBerg Pages)

Open
#94 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
74
Forks
33
Avg merge
3m
Merged PRs (30d)
1

Description

I have currently a _workflow_ with an **build** step and a **deploy** step, that works as expected:

```yml
when:
- event: push
branch: main

steps:
build:
image: node:slim
commands:
- corepack enable
- pnpm install --frozen-lockfile
- pnpm run build

deploy:
image: alpine/git
secrets:
- git_token
environment:
- BUILD_DIR=dist
- TARGET_BRANCH=pages
commands:
# Git configuration
- git config --global user.name "$CI_COMMIT_AUTHOR"
- git config --global user.email "$CI_COMMIT_AUTHOR_EMAIL"
- git clone -b $TARGET_BRANCH https://$GIT_TOKEN@codeberg.org/${CI_REPO}.git $TARGET_BRANCH
# Copy build
- cp -ar $BUILD_DIR/. $TARGET_BRANCH/
- cp .domains $CI_REPO_NAME || true # Ignore if it doesn't exist
# Commit & Push
- cd $TARGET_BRANCH
- git add .
- git diff-index --quiet HEAD || git commit -m "$CI_COMMIT_MESSAGE"
- git push
```

How can i achieve the _same_ as:
```yml
...

steps:
...

deploy:
image: alpine/git
secrets:
- git_token
environment:
- BUILD_DIR=dist
- TARGET_BRANCH=pages
commands:
# Git configuration
- git config --global user.name "$CI_COMMIT_AUTHOR"
- git config --global user.email "$CI_COMMIT_AUTHOR_EMAIL"
- git clone -b $TARGET_BRANCH https://$GIT_TOKEN@codeberg.org/${CI_REPO}.git $TARGET_BRANCH
# Copy build
- cp -ar $BUILD_DIR/. $TARGET_BRANCH/
- cp .domains $CI_REPO_NAME || true # Ignore if it doesn't exist
# Commit & Push
- cd $TARGET_BRANCH
- git add .
- git diff-index --quiet HEAD || git commit -m "$CI_COMMIT_MESSAGE"
- git push
```

but with [appleboy/drone-git-push](https://woodpecker-ci.org/plugins/Git%20Push)?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the plugin's existing usage documentation and the linked Git Push page, then compare its options with the shown workflow. Document the equivalent configuration for building or copying a subdirectory to another branch and pushing only when changes exist; completion means a newcomer can follow the example for GitHub or CodeBerg Pages.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, git, yaml
Domain
ci-cd, devops, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.