Skip to content

Commit d5a4f23

Browse files
fmartingrona-agent
andauthored
ci: add DockerHub publishing for versioned releases (#1148)
- Push versioned images (v*) to shioriapp/shiori on DockerHub - Maintain existing GitHub Container Registry publishing - Add DockerHub authentication for tagged releases only - Preserve backward compatibility for master and PR builds Co-authored-by: Ona <no-reply@ona.com>
1 parent ca949c5 commit d5a4f23

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/_buildx.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ jobs:
4242
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
4343
run: |
4444
REPO=ghcr.io/${{ github.repository }}
45+
DOCKERHUB_REPO=shioriapp/shiori
4546
TAG=$(git describe --tags)
4647
if [[ "$TAG" == *"rc"* ]]
4748
then
4849
TAG2="dev"
4950
else
5051
TAG2="latest"
5152
fi
52-
echo "tag_flags=--tag $REPO:${{ inputs.tag_prefix }}$TAG --tag $REPO:${{ inputs.tag_prefix }}$TAG2" >> $GITHUB_ENV
53+
echo "tag_flags=--tag $REPO:${{ inputs.tag_prefix }}$TAG --tag $REPO:${{ inputs.tag_prefix }}$TAG2 --tag $DOCKERHUB_REPO:${{ inputs.tag_prefix }}$TAG --tag $DOCKERHUB_REPO:${{ inputs.tag_prefix }}$TAG2" >> $GITHUB_ENV
5354
5455
# Every pull request
5556
- name: Prepare pull request tags
@@ -63,4 +64,8 @@ jobs:
6364
run: |
6465
set -x
6566
echo "${{ secrets.GITHUB_TOKEN }}" | docker login -u "${{ github.repository_owner }}" --password-stdin ghcr.io
67+
# Login to DockerHub for versioned releases
68+
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == refs/tags/v* ]]; then
69+
echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
70+
fi
6671
make buildx CONTAINERFILE_NAME=${{ inputs.dockerfile }} CONTAINER_BUILDX_OPTIONS="--push ${{ env.tag_flags }}"

0 commit comments

Comments
 (0)