mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-25 11:46:43 +01:00
Fixes Publish to Github Packages (#18180)
1. Creates a publishPackages function in tools/release/release_utils.sh 2. Uses the publishPackages function in publish_release workflow Fixes issue 18138 Signed-off-by: Nagesh Bansal <nageshbansal59@gmail.com> Co-authored-by: Wang Yan <wangyan@vmware.com>
This commit is contained in:
parent
9b61d34c4c
commit
125daf9cdb
5
.github/workflows/publish_release.yml
vendored
5
.github/workflows/publish_release.yml
vendored
@ -58,7 +58,10 @@ jobs:
|
||||
run: |
|
||||
tar -zxf ${{ env.OFFLINE_PACKAGE_PATH }}
|
||||
docker load -i ./harbor/harbor.${{ env.BASE_TAG }}.tar.gz
|
||||
source tools/release/release_utils.sh && publishImages ${{ env.CUR_TAG }} ${{ env.BASE_TAG }} ${{ secrets.DOCKER_HUB_USERNAME }} ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||
images="$(docker images --format "{{.Repository}}" --filter=reference='goharbor/*:${{ env.BASE_TAG }}' | xargs)"
|
||||
source tools/release/release_utils.sh
|
||||
publishImages ${{ env.CUR_TAG }} ${{ env.BASE_TAG }} ${{ secrets.DOCKER_HUB_USERNAME }} ${{ secrets.DOCKER_HUB_PASSWORD }} $images
|
||||
publishPackages ${{ env.CUR_TAG }} ${{ env.BASE_TAG }} ${{ github.actor }} ${{ secrets.GITHUB_TOKEN }} $images
|
||||
- name: Generate release notes
|
||||
run: |
|
||||
release_notes_path=$(pwd)/release-notes.txt
|
||||
|
@ -59,8 +59,8 @@ function publishImages {
|
||||
local baseTag=$2
|
||||
local dockerHubUser=$3
|
||||
local dockerHubPassword=$4
|
||||
local images=${@:5}
|
||||
docker login -u $dockerHubUser -p $dockerHubPassword
|
||||
local images="$(docker images --format "{{.Repository}}" --filter=reference='goharbor/*:'$baseTag'')"
|
||||
for image in $images
|
||||
do
|
||||
echo "push image: $image"
|
||||
@ -70,6 +70,22 @@ function publishImages {
|
||||
docker logout
|
||||
}
|
||||
|
||||
function publishPackages {
|
||||
local curTag=$1
|
||||
local baseTag=$2
|
||||
local ghcrUser=$3
|
||||
local ghcrPassword=$4
|
||||
local images=${@:5}
|
||||
docker login ghcr.io -u $ghcrUser -p $ghcrPassword
|
||||
for image in $images
|
||||
do
|
||||
echo "push image: $image"
|
||||
docker tag $image:$baseTag "ghcr.io/"$image:$curTag
|
||||
retry 5 docker push "ghcr.io/"$image:$curTag
|
||||
done
|
||||
docker logout ghcr.io
|
||||
}
|
||||
|
||||
function retry {
|
||||
local -r -i max="$1"; shift
|
||||
local -i n=1
|
||||
|
Loading…
Reference in New Issue
Block a user