mirror of
https://github.com/octoleo/octosync.git
synced 2024-11-24 21:57:36 +00:00
Moved to octoleo. Adds option to pass config via url.
This commit is contained in:
parent
150c8767c7
commit
969c9ffc23
13
.github/workflows/joomla4.0-dev-lang.yml
vendored
13
.github/workflows/joomla4.0-dev-lang.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
# We use this approach to sign all commits
|
# We use this approach to sign all commits
|
||||||
# Also to use basic git commands in the sync script
|
# Also to use basic git commands in the sync script
|
||||||
# with no further authentication needed
|
# with no further authentication needed
|
||||||
# see: https://github.com/vdm-io/github-user
|
# see: https://github.com/octoleo/github-user
|
||||||
- name: Setup gitHub User Details
|
- name: Setup gitHub User Details
|
||||||
# how to set secrets?
|
# how to set secrets?
|
||||||
# see: https://docs.github.com/en/actions/reference/encrypted-secrets
|
# see: https://docs.github.com/en/actions/reference/encrypted-secrets
|
||||||
@ -38,11 +38,10 @@ jobs:
|
|||||||
# A id_ed25519.pub ssh public key liked to the github user account
|
# A id_ed25519.pub ssh public key liked to the github user account
|
||||||
SSH_PUB: ${{ secrets.SSH_PUB }}
|
SSH_PUB: ${{ secrets.SSH_PUB }}
|
||||||
run: |
|
run: |
|
||||||
/bin/bash <(/bin/curl -s https://raw.githubusercontent.com/vdm-io/github-user/master/src/setup.sh) --gpg-key "$GPG_KEY" --gpg-user "$GPG_USER" --ssh-key "$SSH_KEY" --ssh-pub "$SSH_PUB" --git-user "$GIT_USER" --git-email "$GIT_EMAIL" --git-token "$GIT_TOKEN"
|
/bin/bash <(/bin/curl -s https://raw.githubusercontent.com/octoleo/github-user/master/src/setup.sh) --gpg-key "$GPG_KEY" --gpg-user "$GPG_USER" --ssh-key "$SSH_KEY" --ssh-pub "$SSH_PUB" --git-user "$GIT_USER" --git-email "$GIT_EMAIL" --git-token "$GIT_TOKEN"
|
||||||
- name: Clone Sync Bot Repo
|
|
||||||
# this is the repo that does the work
|
|
||||||
run: |
|
|
||||||
/bin/git clone -b master --single-branch git@github.com:vdm-io/github-sync-bot.git bot
|
|
||||||
- name: Sync The Repo Files
|
- name: Sync The Repo Files
|
||||||
|
# you can pass your config by url
|
||||||
|
# this means you can get your config file from anywhere
|
||||||
|
# we have --dry added here since we are still in development stage once in production we will remove --dry
|
||||||
run: |
|
run: |
|
||||||
/bin/bash ./bot/src/sync.sh --conf=bot/conf/joomla4.0-dev-lang --dry
|
/bin/bash <(/bin/curl -s https://raw.githubusercontent.com/octoleo/octoleo/master/src/sync.sh) --conf=https://raw.githubusercontent.com/octoleo/octoleo/master/conf/joomla4.0-dev-lang --dry
|
||||||
|
12
.github/workflows/keep-active.yml
vendored
12
.github/workflows/keep-active.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
# We use this approach to sign all commits
|
# We use this approach to sign all commits
|
||||||
# Also to use basic git commands in the sync script
|
# Also to use basic git commands in the sync script
|
||||||
# with no further authentication needed
|
# with no further authentication needed
|
||||||
# see: https://github.com/vdm-io/github-user
|
# see: https://github.com/octoleo/github-user
|
||||||
- name: Setup gitHub User Details
|
- name: Setup gitHub User Details
|
||||||
# how to set secrets?
|
# how to set secrets?
|
||||||
# see: https://docs.github.com/en/actions/reference/encrypted-secrets
|
# see: https://docs.github.com/en/actions/reference/encrypted-secrets
|
||||||
@ -35,11 +35,11 @@ jobs:
|
|||||||
# A id_ed25519.pub ssh public key liked to the github user account
|
# A id_ed25519.pub ssh public key liked to the github user account
|
||||||
SSH_PUB: ${{ secrets.SSH_PUB }}
|
SSH_PUB: ${{ secrets.SSH_PUB }}
|
||||||
run: |
|
run: |
|
||||||
/bin/bash <(/bin/curl -s https://raw.githubusercontent.com/vdm-io/github-user/master/src/setup.sh) --gpg-key "$GPG_KEY" --gpg-user "$GPG_USER" --ssh-key "$SSH_KEY" --ssh-pub "$SSH_PUB" --git-user "$GIT_USER" --git-email "$GIT_EMAIL"
|
/bin/bash <(/bin/curl -s https://raw.githubusercontent.com/octoleo/github-user/master/src/setup.sh) --gpg-key "$GPG_KEY" --gpg-user "$GPG_USER" --ssh-key "$SSH_KEY" --ssh-pub "$SSH_PUB" --git-user "$GIT_USER" --git-email "$GIT_EMAIL"
|
||||||
- name: Clone Bot Repo
|
- name: Clone Octoleo Repo
|
||||||
# this is the repo that does the work
|
# this is the repo that does the work
|
||||||
run: |
|
run: |
|
||||||
/bin/git clone -b master --single-branch git@github.com:vdm-io/github-sync-bot.git bot
|
/bin/git clone -b master --single-branch git@github.com:octoleo/octoleo.git octoleo
|
||||||
- name: Set Active
|
- name: Set Active
|
||||||
run: |
|
run: |
|
||||||
cd bot
|
cd bot
|
||||||
|
14
.github/workflows/lang-joomla4.0-dev.yml
vendored
14
.github/workflows/lang-joomla4.0-dev.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
# We use this approach to sign all commits
|
# We use this approach to sign all commits
|
||||||
# Also to use basic git commands in the sync script
|
# Also to use basic git commands in the sync script
|
||||||
# with no further authentication needed
|
# with no further authentication needed
|
||||||
# see: https://github.com/vdm-io/github-user
|
# see: https://github.com/octoleo/github-user
|
||||||
- name: Setup gitHub User Details
|
- name: Setup gitHub User Details
|
||||||
# how to set secrets?
|
# how to set secrets?
|
||||||
# see: https://docs.github.com/en/actions/reference/encrypted-secrets
|
# see: https://docs.github.com/en/actions/reference/encrypted-secrets
|
||||||
@ -38,11 +38,11 @@ jobs:
|
|||||||
# A id_ed25519.pub ssh public key liked to the github user account
|
# A id_ed25519.pub ssh public key liked to the github user account
|
||||||
SSH_PUB: ${{ secrets.SSH_PUB }}
|
SSH_PUB: ${{ secrets.SSH_PUB }}
|
||||||
run: |
|
run: |
|
||||||
/bin/bash <(/bin/curl -s https://raw.githubusercontent.com/vdm-io/github-user/master/src/setup.sh) --gpg-key "$GPG_KEY" --gpg-user "$GPG_USER" --ssh-key "$SSH_KEY" --ssh-pub "$SSH_PUB" --git-user "$GIT_USER" --git-email "$GIT_EMAIL" --git-token "$GIT_TOKEN"
|
/bin/bash <(/bin/curl -s https://raw.githubusercontent.com/octoleo/github-user/master/src/setup.sh) --gpg-key "$GPG_KEY" --gpg-user "$GPG_USER" --ssh-key "$SSH_KEY" --ssh-pub "$SSH_PUB" --git-user "$GIT_USER" --git-email "$GIT_EMAIL" --git-token "$GIT_TOKEN"
|
||||||
- name: Clone Sync Bot Repo
|
|
||||||
# this is the repo that does the work
|
|
||||||
run: |
|
|
||||||
/bin/git clone -b master --single-branch git@github.com:vdm-io/github-sync-bot.git bot
|
|
||||||
- name: Sync The Repo Files
|
- name: Sync The Repo Files
|
||||||
|
# you can pass your config by url
|
||||||
|
# this means you can get your config file from anywhere
|
||||||
|
# we have --dry added here since we are still in development stage once in production we will remove --dry
|
||||||
run: |
|
run: |
|
||||||
/bin/bash ./bot/src/sync.sh --conf=bot/conf/lang-joomla4.0-dev --dry
|
/bin/bash <(/bin/curl -s https://raw.githubusercontent.com/octoleo/octoleo/master/src/sync.sh) --conf=https://raw.githubusercontent.com/octoleo/octoleo/master/conf/lang-joomla4.0-dev --dry
|
||||||
|
|
||||||
|
15
.github/workflows/test.yml
vendored
15
.github/workflows/test.yml
vendored
@ -1,5 +1,6 @@
|
|||||||
name: "Test Sync Bot"
|
name: "Test Sync Bot"
|
||||||
|
|
||||||
|
on:
|
||||||
# so we can manually run a sync test
|
# so we can manually run a sync test
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ jobs:
|
|||||||
# We use this approach to sign all commits
|
# We use this approach to sign all commits
|
||||||
# Also to use basic git commands in the sync script
|
# Also to use basic git commands in the sync script
|
||||||
# with no further authentication needed
|
# with no further authentication needed
|
||||||
# see: https://github.com/vdm-io/github-user
|
# see: https://github.com/octoleo/github-user
|
||||||
- name: Setup gitHub User Details
|
- name: Setup gitHub User Details
|
||||||
# how to set secrets?
|
# how to set secrets?
|
||||||
# see: https://docs.github.com/en/actions/reference/encrypted-secrets
|
# see: https://docs.github.com/en/actions/reference/encrypted-secrets
|
||||||
@ -33,12 +34,12 @@ jobs:
|
|||||||
# A id_ed25519.pub ssh public key liked to the github user account
|
# A id_ed25519.pub ssh public key liked to the github user account
|
||||||
SSH_PUB: ${{ secrets.SSH_PUB }}
|
SSH_PUB: ${{ secrets.SSH_PUB }}
|
||||||
run: |
|
run: |
|
||||||
/bin/bash <(/bin/curl -s https://raw.githubusercontent.com/vdm-io/github-user/master/src/setup.sh) --gpg-key "$GPG_KEY" --gpg-user "$GPG_USER" --ssh-key "$SSH_KEY" --ssh-pub "$SSH_PUB" --git-user "$GIT_USER" --git-email "$GIT_EMAIL" --git-token "$GIT_TOKEN"
|
/bin/bash <(/bin/curl -s https://raw.githubusercontent.com/octoleo/github-user/master/src/setup.sh) --gpg-key "$GPG_KEY" --gpg-user "$GPG_USER" --ssh-key "$SSH_KEY" --ssh-pub "$SSH_PUB" --git-user "$GIT_USER" --git-email "$GIT_EMAIL" --git-token "$GIT_TOKEN"
|
||||||
- name: Clone Sync Bot Repo
|
- name: Clone Sync Bot Repo
|
||||||
# this is the repo that does the work
|
# this is the repo that does the work
|
||||||
run: |
|
run: |
|
||||||
/bin/git clone -b master --single-branch git@github.com:vdm-io/github-sync-bot.git bot
|
/bin/git clone -b master --single-branch git@github.com:octoleo/octoleo.git octoleo
|
||||||
- name: Sync The Repo Files
|
- name: Sync The Repo Files
|
||||||
run: |
|
run: |
|
||||||
/bin/bash ./bot/src/sync.sh --conf=bot/conf/joomla4.0-dev-lang --test
|
/bin/bash ./octoleo/src/sync.sh --conf=octoleo/conf/joomla4.0-dev-lang --test
|
||||||
/bin/bash ./bot/src/sync.sh --conf=bot/conf/lang-joomla4.0-dev --test
|
/bin/bash ./octoleo/src/sync.sh --conf=octoleo/conf/lang-joomla4.0-dev --test
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
.idea
|
.idea
|
||||||
source_repo
|
source_repo
|
||||||
target_repo
|
target_repo
|
||||||
|
config_file_from_url
|
||||||
|
17
README.md
17
README.md
@ -1,8 +1,17 @@
|
|||||||
## Github Sync Bot Setup
|
# OCTOLEO
|
||||||
|
|
||||||
- We use this script to setup a github user on the Ubuntu systems in the Github Actions Workflows. See setup instructions below.
|
The option to move files or whole folders from repository to another is what Octoleo does. You can with [configurations](https://github.com/octoleo/octoleo/blob/master/conf/example) setup multiple syncing relationships which you can run in multiple [workflow actions](https://github.com/octoleo/octoleo/blob/master/.github/workflows/test.yml).
|
||||||
- Then the sync of each set of repositories are manage with a config file found in the conf folder.
|
|
||||||
- So we have to setup multiple workflows for each set repositories (config) you would like to sync.
|
## Octoleo Sync Bot Setup
|
||||||
|
|
||||||
|
- We use this script to setup a github user on the Ubuntu systems in the Github Actions Workflows. [See setup instructions below](https://github.com/octoleo/octoleo#how-to-setup-github-user).
|
||||||
|
- Then the sync of each set of repositories are managed with a [config file](https://github.com/octoleo/octoleo/blob/master/conf/example) found in the [conf folder](https://github.com/octoleo/octoleo/blob/master/conf).
|
||||||
|
- So we can then setup [multiple workflows](https://github.com/octoleo/octoleo/blob/master/.github/workflows) for each set repositories (config) you would like to sync.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
```yml
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
### How To SETUP gitHub User
|
### How To SETUP gitHub User
|
||||||
|
|
||||||
|
26
src/sync.sh
26
src/sync.sh
@ -5,18 +5,17 @@ command -v git >/dev/null 2>&1 || {
|
|||||||
echo >&2 "We require git for this script to run, but it's not installed. Aborting."
|
echo >&2 "We require git for this script to run, but it's not installed. Aborting."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
# command -v gh >/dev/null 2>&1 || {
|
command -v curl >/dev/null 2>&1 || {
|
||||||
# echo >&2 "We require github CLI for this script to run, but it's not installed. Aborting."
|
echo >&2 "We require curl for this script to run, but it's not installed. Aborting."
|
||||||
# exit 1
|
exit 1
|
||||||
# }
|
}
|
||||||
# will still add some github toke check (that it exist)
|
|
||||||
|
|
||||||
# get start time
|
# get start time
|
||||||
STARTBUILD=$(date +"%s")
|
STARTBUILD=$(date +"%s")
|
||||||
# use UTC+00:00 time also called zulu
|
# use UTC+00:00 time also called zulu
|
||||||
STARTDATE=$(TZ=":ZULU" date +"%m/%d/%Y @ %R (UTC)")
|
STARTDATE=$(TZ=":ZULU" date +"%m/%d/%Y @ %R (UTC)")
|
||||||
# BOT name
|
# BOT name
|
||||||
BOT_NAME="Github Sync Bot v1.0"
|
BOT_NAME="Octoleo v1.0"
|
||||||
|
|
||||||
# main function ˘Ô≈ôﺣ
|
# main function ˘Ô≈ôﺣ
|
||||||
function main() {
|
function main() {
|
||||||
@ -166,7 +165,7 @@ function rebaseWithUpstream() {
|
|||||||
# just a random remote name
|
# just a random remote name
|
||||||
local git_upstream="stroomOp"
|
local git_upstream="stroomOp"
|
||||||
# go into repo folder
|
# go into repo folder
|
||||||
cd ${git_folder}
|
cd ${git_folder} || exit 23
|
||||||
# check out the upstream repository
|
# check out the upstream repository
|
||||||
git checkout -b "${git_upstream}" "$git_branch"
|
git checkout -b "${git_upstream}" "$git_branch"
|
||||||
git pull ${git_repo_upstream} "$git_branch"
|
git pull ${git_repo_upstream} "$git_branch"
|
||||||
@ -200,7 +199,8 @@ function rebaseWithUpstream() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# return to original folder
|
# return to original folder
|
||||||
cd "${current_folder}"
|
cd "${current_folder}" || exit 24
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# move the source folders and files to the target folders
|
# move the source folders and files to the target folders
|
||||||
@ -605,6 +605,16 @@ while :; do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# check if the config is passed via a URL
|
||||||
|
if [[ "${CONFIG_FILE}" =~ ^"http:" ]] || [[ "${CONFIG_FILE}" =~ ^"https:" ]]; then
|
||||||
|
if [[ $(wget -S --spider "${CONFIG_FILE}" 2>&1 | grep 'HTTP/1.1 200 OK') ]]; then
|
||||||
|
wget --quiet "${CONFIG_FILE}" -O config_file_from_url
|
||||||
|
CONFIG_FILE="config_file_from_url"
|
||||||
|
else
|
||||||
|
echo >&2 "The config:${CONFIG_FILE} is not a valid URL. Aborting."
|
||||||
|
exit 18
|
||||||
|
fi
|
||||||
|
fi
|
||||||
# We must have a config file
|
# We must have a config file
|
||||||
[ ! -f "${CONFIG_FILE}" ] && echo >&2 "The config:${CONFIG_FILE} is not set or found. Aborting." && exit 18
|
[ ! -f "${CONFIG_FILE}" ] && echo >&2 "The config:${CONFIG_FILE} is not set or found. Aborting." && exit 18
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user