Skip to content

Commit

Permalink
Update docker-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
oproprioleonardo authored Sep 14, 2024
1 parent 766b71e commit 65c6596
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Docker Package
name: Tickets IFSP API - GHCR

on:
push:
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
retention-days: 2

docker-build:
name: Build and Push Docker Image
name: Build and Push Docker Image to GHCR
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/homolog'
Expand All @@ -75,8 +75,8 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker registry
run: echo "${{ secrets.CI_REGISTRY_PASSWORD }}" | docker login ${{ secrets.CI_REGISTRY }} -u "${{ secrets.CI_REGISTRY_USER }}" --password-stdin
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin

- name: Build and push Docker image
run: |
Expand All @@ -87,9 +87,9 @@ jobs:
tag="${{ github.ref_name }}"
echo "Running on branch '${{ github.ref_name }}': tag = '${{ github.ref_name }}'"
fi
docker build --pull -t ${{ secrets.CI_REGISTRY_IMAGE }}:$tag .
docker push ${{ secrets.CI_REGISTRY_IMAGE }}:$tag
docker build --pull -t ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:$tag .
docker push ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:$tag
- name: Clean up Docker images
run: |
docker rmi ${{ secrets.CI_REGISTRY_IMAGE }}:$tag || true
docker rmi ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:$tag || true

0 comments on commit 65c6596

Please sign in to comment.