Merge pull request #13962 from danfengliu/pass-secret-to-push-function-in-build-workflow

Pass git action secret tp push image function in build workflow
This commit is contained in:
danfengliu 2021-01-12 10:48:46 +08:00 committed by GitHub
commit 26a87c1fcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -97,7 +97,7 @@ jobs:
uploader harbor-offline-installer-latest.tgz.asc $harbor_target_bucket
echo "BUILD_BUNDLE=$harbor_offline_build_bundle" >> $GITHUB_ENV
publishImage $target_branch $Harbor_Assets_Version
publishImage $target_branch $Harbor_Assets_Version "${{ secrets.DOCKER_HUB_USERNAME }}" "${{ secrets.DOCKER_HUB_PASSWORD }}"
- name: Slack Notification
uses: sonots/slack-notice-action@v3

View File

@ -21,7 +21,7 @@ function publishImage {
fi
# rename the images with tag "dev" and push to Docker Hub
docker images
docker login -u $DOCKER_HUB_USERNAME -p $DOCKER_HUB_PASSWORD
docker login -u $3 -p $4
docker images | grep goharbor | grep -v "\-base" | sed -n "s|\(goharbor/[-._a-z0-9]*\)\s*\(.*$2\).*|docker tag \1:\2 \1:$image_tag;docker push \1:$image_tag|p" | bash
echo "Images are published successfully"
docker images