Skip to content

Commit

Permalink
chore: update Docker workflow to push image to ghcr with sudo and log…
Browse files Browse the repository at this point in the history
… in with github token
  • Loading branch information
HsiangNianian committed Sep 24, 2024
1 parent c115ba4 commit dd80f47
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jobs:
run: sudo docker build . --file Dockerfile.prod --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"

- name: Log in to registry
run: echo "${{ secrets.ACCESS_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
#
run: echo "${{ secrets.ACCESS_TOKEN }}" | sudo docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
Expand All @@ -45,7 +45,7 @@ jobs:
if [ -n "${{ github.event.inputs.version }}" ]; then
VERSION=${{ github.event.inputs.version }}
else
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
VERSION=$(echo "${{ github.ref }}")
fi
# This strips the "v" prefix from the tag name.
Expand All @@ -54,5 +54,5 @@ jobs:
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
sudo docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
sudo docker push $IMAGE_ID:$VERSION

0 comments on commit dd80f47

Please sign in to comment.