Skip to content

Commit

Permalink
update: base-image version
Browse files Browse the repository at this point in the history
  • Loading branch information
k8scat committed Jan 8, 2022
1 parent 43f27d0 commit 6cb3342
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 95 deletions.
82 changes: 0 additions & 82 deletions .github/workflows/example.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/github-org-to-gitee-org.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
repo_list=$(gh repo list huayin-opensource -L 1000 --json name -t '{{range $i, $n := .}}{{if (gt $i 0)}},{{end}}{{$n.name}}{{end}}')
echo "::set-output name=repo_list::${repo_list}"
- name: Mirror Git
- name: GitHub Org to Gitee Org
uses: k8scat/[email protected]
with:
source_protocol: https
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-to-bitbucket.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
repo_list=$(gh repo list k8scat -L 1000 --json name -t '{{range $i, $n := .}}{{if (gt $i 0)}},{{end}}{{$n.name}}{{end}}')
echo "::set-output name=repo_list::${repo_list}"
- name: Mirror Git
- name: GitHub to BitBucket
uses: k8scat/[email protected]
with:
source_protocol: https
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/github-to-gitea.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: GitHub to Gitee

on:
workflow_dispatch:
schedule:
- cron: "0 2 * * 3"

jobs:
mirror:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Login Source GitHub
run: |
gh --version
echo "${{ secrets.SOURCE_TOKEN }}" | gh auth login --with-token
gh auth status
- name: List repos
id: list_repos
run: |
repo_list=$(gh repo list -L 1000 --json name -t '{{range $i, $n := .}}{{if (gt $i 0)}},{{end}}{{$n.name}}{{end}}')
echo "::set-output name=repo_list::${repo_list}"
- name: GitHub to Gitea
uses: k8scat/[email protected]
with:
source_protocol: https
source_host: github.com
source_username: k8scat
source_token: ${{ secrets.SOURCE_TOKEN }}
dest_protocol: https
dest_host: gitee.com
dest_username: k8scat
dest_token: ${{ secrets.DEST_TOKEN_GITEA }}
push_tags: "true"
mirror_repos: ${{ steps.list_repos.outputs.repo_list }}
ignored_repos: "Gigrator"
dest_create_repo_script: |
curl \
-H 'Content-Type: application/json' \
-H "Authorization: token ${INPUT_DEST_TOKEN}" \
-d "{\"name\":\"test\",\"private\":true}" \
'https://gitea.com/api/v1/user/repos'
dest_delete_repo_script: |
curl \
-X DELETE \
-H "Authorization: token ${INPUT_DEST_TOKEN}" \
"https://gitea.com/api/v1/repos/${INPUT_DEST_USERNAME}/${REPO_NAME}"
lark_webhook: ${{ secrets.LARK_WEBHOOK }}
notify_prefix: "GitHub to Gitea"
force_push: "true"
2 changes: 1 addition & 1 deletion .github/workflows/github-to-gitee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
repo_list=$(gh repo list -L 1000 --json name -t '{{range $i, $n := .}}{{if (gt $i 0)}},{{end}}{{$n.name}}{{end}}')
echo "::set-output name=repo_list::${repo_list}"
- name: Mirror Git
- name: GitHub to Gitee
uses: k8scat/[email protected]
with:
source_protocol: https
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-to-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
repo_list=$(gh repo list k8scat -L 1000 --json name -t '{{range $i, $n := .}}{{if (gt $i 0)}},{{end}}{{$n.name}}{{end}}')
echo "::set-output name=repo_list::${repo_list}"
- name: Mirror Git
- name: GitHub to GitHub
uses: k8scat/[email protected]
with:
source_protocol: https
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-to-gitlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
repo_list=$(gh repo list -L 1000 --json name -t '{{range $i, $n := .}}{{if (gt $i 0)}},{{end}}{{$n.name}}{{end}}')
echo "::set-output name=repo_list::${repo_list}"
- name: Mirror Git
- name: GitHub to GitLab
uses: k8scat/[email protected]
with:
source_protocol: https
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/gigrator/base:0.0.6
FROM ghcr.io/gigrator/base:0.0.7
LABEL maintainer="K8sCat <[email protected]>"
LABEL repository="https://github.com/k8scat/action-mirror-git.git"
COPY mirror.sh /mirror.sh
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
os = $(shell uname -s)

version = 0.1.0
version = 0.1.1
image = mirror-git:$(version)

cr_user = gigrator
Expand Down Expand Up @@ -44,7 +44,6 @@ endif
ifeq ($(os),Darwin)
sed -i "" 's/$(version)/$(new_version)/g' Makefile
sed -i "" 's/$(version)/$(new_version)/g' action.yml
sed -i "" 's/$(version)/$(new_version)/g' .github/workflows/example.yml
sed -i "" 's/$(version)/$(new_version)/g' README.md
sed -i "" 's/$(version)/$(new_version)/g' .github/workflows/github-to-github.yml
sed -i "" 's/$(version)/$(new_version)/g' .github/workflows/github-to-gitee.yml
Expand All @@ -54,7 +53,6 @@ ifeq ($(os),Darwin)
else
sed -i 's/$(version)/$(new_version)/g' Makefile
sed -i 's/$(version)/$(new_version)/g' action.yml
sed -i 's/$(version)/$(new_version)/g' .github/workflows/example.yml
sed -i 's/$(version)/$(new_version)/g' README.md
sed -i 's/$(version)/$(new_version)/g' .github/workflows/github-to-github.yml
sed -i 's/$(version)/$(new_version)/g' .github/workflows/github-to-gitee.yml
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ dest_delete_repo_script: |
- [GitHub to GitHub](./.github/workflows/github-to-github.yml)
- [GitHub to GitLab](./.github/workflows/github-to-gitlab.yml)
- [GitHub to BitBucket](./.github/workflows/github-to-bitbucket.yml)
- [GitHub to Gitea]
## Run
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ inputs:
default: "false"
runs:
using: "docker"
image: "docker://ghcr.io/k8scat/mirror-git:0.1.0"
image: "docker://ghcr.io/k8scat/mirror-git:0.1.1"
6 changes: 3 additions & 3 deletions mirror.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ function mirror() {
source_addr=$(gen_source_addr)
echo "source_addr: ${source_addr}"

dest_addr=$(gen_dest_addr)
echo "dest_addr: ${dest_addr}"

if ! git clone --bare "${source_addr}" "${REPO_NAME}"; then
notify "Failed to clone ${source_addr}"
if [[ "${INPUT_IGNORE_ERROR}" = "true" ]]; then
Expand All @@ -221,6 +218,9 @@ function mirror() {
fi
fi

dest_addr=$(gen_dest_addr)
echo "dest_addr: ${dest_addr}"

repo_dir="${WORKDIR}/${REPO_NAME}"
cd "${repo_dir}" || exit 1
if ! git push --all -f "${dest_addr}"; then
Expand Down

0 comments on commit 6cb3342

Please sign in to comment.