From 3a420d6ec5c031ce5105444dffa4b21bd49130fa Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Tue, 9 Jul 2024 21:52:33 +0800 Subject: [PATCH] add workflows sync images --- .github/workflows/sync-images.yaml | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/sync-images.yaml diff --git a/.github/workflows/sync-images.yaml b/.github/workflows/sync-images.yaml new file mode 100644 index 0000000..d86496b --- /dev/null +++ b/.github/workflows/sync-images.yaml @@ -0,0 +1,43 @@ +name: SYNC Images + +on: + schedule: + - cron: "0 0 * * *" + pull_request: + push: + paths: + - 'charts' + - '.github/workflows/sync-images.yaml' + workflow_dispatch: + branches: + - main + +jobs: + sync-images: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Initialization environment + env: + PASSWORD: ${{ secrets.HELM_REPO_PASSWORD }} + shell: bash + run: | + sudo apt update + sudo apt install git -y + echo "$PASSWORD" | docker login --username=admin --password-stdin harbor.onwalk.net + + - name: sync images + shell: bash + run: | + function sync_image() + { + local src_image=$1 + local dest_image=$2 + docker pull $src_image + docker tag $src_image $dest_image + docker push $dest_image + } + sync_image "nginx:1.16.0" "artifact.onwalk.net/public/nginx:1.16.0" + sync_image "busybox:1.28" "artifact.onwalk.net/public/busybox:1.28"