From 313ce9323e96cda41e394d70d733792a27aef3d5 Mon Sep 17 00:00:00 2001 From: Colgrave Date: Wed, 8 Jan 2025 17:34:41 +0000 Subject: [PATCH] Add example for syncing repo with upstream (#67) Add an example of automatic synchronization with an upstream repository. Sorry for the multiple commits, I forgot that I need to make a new branch. Co-authored-by: Patrick Schratz Reviewed-on: https://codeberg.org/Codeberg-CI/examples/pulls/67 Reviewed-by: Patrick Schratz Co-authored-by: Colgrave Co-committed-by: Colgrave --- .woodpecker.yaml | 1 + Git/.woodpecker.yaml | 24 ++++++++++++++++++++++++ README.md | 1 + 3 files changed, 26 insertions(+) create mode 100644 Git/.woodpecker.yaml diff --git a/.woodpecker.yaml b/.woodpecker.yaml index 8a8a1cf..d5294ff 100644 --- a/.woodpecker.yaml +++ b/.woodpecker.yaml @@ -13,6 +13,7 @@ steps: - woodpecker-cli lint Butane/.woodpecker/butane.yaml - woodpecker-cli lint C/ - woodpecker-cli lint Docker/ + - woodpecker-cli lint Git/ - woodpecker-cli lint Golang/ - woodpecker-cli lint Hugo/ - woodpecker-cli lint Idris/ diff --git a/Git/.woodpecker.yaml b/Git/.woodpecker.yaml new file mode 100644 index 0000000..8de0f95 --- /dev/null +++ b/Git/.woodpecker.yaml @@ -0,0 +1,24 @@ +# Git/.woodpecker.yaml +# +# CI step to automatic synchronization with an upstream repository. + +when: + event: [cron, manual] + cron: 'sync' + +steps: + - name: sync + image: docker.io/alpine/git + commands: + - git remote add upstream https://codeberg.org/ + - git fetch upstream + - git checkout main + - git merge upstream/main + + - name: push + image: docker.io/appleboy/drone-git-push:latest + settings: + ssh_key: + from_secret: ssh_key + remote: git@codeberg.org: + branch: main diff --git a/README.md b/README.md index 29a6b08..4ad330b 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ Pull requests are welcome! | [C/.woodpecker/meson-android.yaml](C/.woodpecker/meson-android.yaml) | C/C++ | meson + Android NDK | CI for meson-based projects cross-compiling to Android NDK. | | [Docker/.woodpecker/kaniko.yaml](Docker/.woodpecker/kaniko.yaml) | Dockerfile | [Kaniko][1] | Minimalistic CI pipeline with clear instructions to push a Docker image | | [Docker/.woodpecker/buildx.yaml](Docker/.woodpecker/buildx.yaml) | Dockerfile | [buildx][2] | Build and publish Docker images for multiple architectures on codeberg | +| [Git/.woodpecker.yaml](Git/.woodpecker.yaml) | --- | --- | CI step to automatic synchronization with an upstream repository. | | [Golang/.woodpecker/build.yaml](Golang/.woodpecker/build.yaml) | golang | golang | Simple ci for building and test a Go project | | [Golang/.woodpecker/build-docker.yaml](Golang/.woodpecker/build-docker.yaml) | golang | golang / kaniko | CI to build golang project and build various docker container and publish them on DockerHub | | [Hugo/.woodpecker.yaml](Hugo/.woodpecker.yaml) | Markdown | Hugo | CI step to build static website files and publish them to Codeberg Pages with Hugo |