Skip to content

Commit df0b104

Browse files
committed
fix: Various changes to workflow
1 parent 298b358 commit df0b104

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ jobs:
6464
name: Prepare
6565
id: prep
6666
run: |
67+
IMAGENAME=$(echo ${{ github.repository }} | sed 's/${{ github.repository_owner }}\/docker-//g')
68+
IMAGEPREFIX="ghcr.io/${{ github.repository_owner }}"
69+
IMAGE="${IMAGEPREFIX}/${IMAGENAME}"
70+
echo $IMAGE
6771
if [ "${{ github.event_name }}" = "schedule" ]; then
6872
VERSION=nightly
6973
elif [[ $GITHUB_REF == refs/tags/* ]]; then
@@ -76,16 +80,17 @@ jobs:
7680
elif [[ $GITHUB_REF == refs/pull/* ]]; then
7781
VERSION=pr-${{ github.event.number }}
7882
fi
79-
TAGS="${IMAGENAME}:${VERSION}"
83+
TAGS="${IMAGE}:${VERSION}"
8084
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
8185
MINOR=${VERSION%.*}
8286
MAJOR=${MINOR%.*}
83-
TAGS="$TAGS,${IMAGENAME}:${MINOR},${IMAGENAME}:${MAJOR},${IMAGENAME}:latest"
87+
TAGS="$TAGS,${IMAGE}:${MINOR},${IMAGE}:${MAJOR},${IMAGE}:latest"
8488
elif [ "${{ github.event_name }}" = "push" ]; then
85-
TAGS="$TAGS,${IMAGENAME}:sha-${GITHUB_SHA::8}"
89+
TAGS="$TAGS,${IMAGE}:sha-${GITHUB_SHA::8}"
8690
fi
8791
echo ::set-output name=tags::${TAGS}
88-
echo ::set-output name=version::${MAJOR}.${MINOR}.${PATCH}
92+
echo ::set-output name=imagename::${IMAGENAME}
93+
echo ::set-output name=version::${VERSION}
8994
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
9095
-
9196
name: Hadolint
@@ -120,7 +125,7 @@ jobs:
120125
${{ steps.build-args.outputs.build-arg1 }}
121126
${{ steps.build-args.outputs.build-arg2 }}
122127
labels: |
123-
org.opencontainers.image.title=${{ github.event.repository.name }}
128+
org.opencontainers.image.title=${{ steps.prep.outputs.imagename }}
124129
org.opencontainers.image.description=${{ github.event.repository.description }}
125130
org.opencontainers.image.url=${{ github.event.repository.html_url }}
126131
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
@@ -137,12 +142,11 @@ jobs:
137142
GHTAG=$(echo $i | sed "s/ghcr.io/docker.io/g" | sed "s/${{ github.repository_owner }}/${{ env.DOCKER_USER }}/g")
138143
skopeo copy --all --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ env.DOCKER_USER }}:${{ secrets.DOCKERPASSWORD }} docker://${i} docker://${GHTAG}
139144
done
140-
echo ::set-output name=shortname::$(echo ${{ env.IMAGENAME }} | sed "s/ghcr.io\///g" | sed "s/${{ github.repository_owner }}/${{ env.DOCKER_USER }}/g")
141145
-
142146
name: Docker Hub Description
143147
uses: peter-evans/[email protected]
144148
with:
145149
username: ${{ env.DOCKER_USER }}
146150
password: ${{ secrets.DOCKERPASSWORD }}
147-
repository: ${{ steps.copy_images.outputs.shortname }}
151+
repository: "${{ env.DOCKER_USER }}/${{ steps.prep.outputs.imagename }}"
148152
short-description: ${{ github.event.repository.description }}

0 commit comments

Comments
 (0)