Skip to content

Commit

Permalink
ci: Publish docker images to ghcr.io instead of docker hub
Browse files Browse the repository at this point in the history
  • Loading branch information
binarybaron authored Sep 9, 2024
1 parent 8adf86d commit 91482f1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/build-release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ jobs:
name: Build and Push Docker Image
runs-on: ubuntu-latest
needs: build_binaries
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/[email protected]
Expand All @@ -139,19 +142,20 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set Docker tags
id: docker_tags
run: |
if [[ ${{ github.event.release.tag_name }} == "preview" ]]; then
echo "::set-output name=preview::true"
echo "preview=true" >> $GITHUB_OUTPUT
else
echo "::set-output name=preview::false"
echo "preview=false" >> $GITHUB_OUTPUT
fi
- name: Build and push Docker image
Expand All @@ -172,4 +176,4 @@ jobs:
file: ./Dockerfile
push: true
tags: ${{ env.DOCKER_IMAGE_NAME }}:${{ github.event.release.tag_name }}
if: steps.docker_tags.outputs.preview == 'true'
if: steps.docker_tags.outputs.preview == 'true'

0 comments on commit 91482f1

Please sign in to comment.