Compare commits
No commits in common. "9c0508c2c36cd3a399a45c3c30583e990508f845" and "560450aeeda4be74307beca25975aef96614e96f" have entirely different histories.
9c0508c2c3
...
560450aeed
2 changed files with 4 additions and 17 deletions
12
README.md
12
README.md
|
@ -4,10 +4,8 @@ A plugin to deploy to codeberg pages. Basically takes a folder and pushes it to
|
||||||
|
|
||||||
The following settings changes this plugin's behavior.
|
The following settings changes this plugin's behavior.
|
||||||
|
|
||||||
* folder (required) the folder to deploy.
|
* param1 (optional) does something.
|
||||||
* ssh_key (required) the ssh key to access the repo.
|
* param2 (optional) does something different.
|
||||||
* git_remote (optional) the git repote to push to. Default: `$DRONE_GIT_SSH_URL`
|
|
||||||
* git_branch (optional) the branch to push to. Default: `pages`
|
|
||||||
|
|
||||||
Below is an example `.drone.yml` that uses this plugin.
|
Below is an example `.drone.yml` that uses this plugin.
|
||||||
|
|
||||||
|
@ -22,8 +20,6 @@ steps:
|
||||||
settings:
|
settings:
|
||||||
folder: public
|
folder: public
|
||||||
ssh_key: foo
|
ssh_key: foo
|
||||||
git_remote: git@somegit.com/foo/bar
|
|
||||||
git_branch: pages
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# Building
|
# Building
|
||||||
|
@ -50,10 +46,6 @@ docker run --rm -e PLUGIN_FOLDER=public -e PLUGIN_SSH_KEY=foo \
|
||||||
-e DRONE_COMMIT_BRANCH=master \
|
-e DRONE_COMMIT_BRANCH=master \
|
||||||
-e DRONE_BUILD_NUMBER=43 \
|
-e DRONE_BUILD_NUMBER=43 \
|
||||||
-e DRONE_BUILD_STATUS=success \
|
-e DRONE_BUILD_STATUS=success \
|
||||||
-e PLUGIN_FOLDER=public \
|
|
||||||
-e PLUGIN_SSH_KEY="-----BEGIN OPENSSH PRIVATE KEY-----\n....." \
|
|
||||||
-e PLUGIN_GIT_REMOTE=git@somegit.com/foo/bar \
|
|
||||||
-e PLUGIN_GIT_BRANCH=pages \
|
|
||||||
-w /drone/src \
|
-w /drone/src \
|
||||||
-v $(pwd):/drone/src \
|
-v $(pwd):/drone/src \
|
||||||
itsblue.dev/plugins/codeberg-pages-deploy
|
itsblue.dev/plugins/codeberg-pages-deploy
|
||||||
|
|
|
@ -26,7 +26,6 @@ type Args struct {
|
||||||
Folder string `envconfig:"PLUGIN_FOLDER"`
|
Folder string `envconfig:"PLUGIN_FOLDER"`
|
||||||
SshKey string `envconfig:"PLUGIN_SSH_KEY"`
|
SshKey string `envconfig:"PLUGIN_SSH_KEY"`
|
||||||
GitRemote string `envconfig:"PLUGIN_GIT_REMOTE"`
|
GitRemote string `envconfig:"PLUGIN_GIT_REMOTE"`
|
||||||
GitBranch string `envconfig:"PLUGIN_GIT_BRANCH"`
|
|
||||||
GitRemoteFromDrone string `envconfig:"DRONE_GIT_SSH_URL"`
|
GitRemoteFromDrone string `envconfig:"DRONE_GIT_SSH_URL"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,10 +87,6 @@ func checkArgs(args *Args) error {
|
||||||
args.GitRemote = args.GitRemoteFromDrone
|
args.GitRemote = args.GitRemoteFromDrone
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.GitBranch == "" {
|
|
||||||
args.GitBranch = BRANCH_NAME
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +127,7 @@ func copyFiles(args Args) error {
|
||||||
func initRepo(args Args) error {
|
func initRepo(args Args) error {
|
||||||
cmd := exec.Command(
|
cmd := exec.Command(
|
||||||
"git",
|
"git",
|
||||||
"init", "-b", args.GitBranch, "/tmp/pages")
|
"init", "-b", BRANCH_NAME, "/tmp/pages")
|
||||||
|
|
||||||
if err := execute(cmd); err != nil {
|
if err := execute(cmd); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -154,7 +149,7 @@ func doCommit(args Args) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func push(args Args) error {
|
func push(args Args) error {
|
||||||
return execute(repo.RemotePushNamedBranch(args.GitRemote, args.GitBranch, args.GitBranch, true, false))
|
return execute(repo.RemotePushNamedBranch(args.GitRemote, BRANCH_NAME, BRANCH_NAME, true, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
func execute(cmd *exec.Cmd) error {
|
func execute(cmd *exec.Cmd) error {
|
||||||
|
|
Loading…
Reference in a new issue