diff --git a/.github/workflows/release-docker-images.yml b/.github/workflows/release-docker-images.yml index 673c8b61a..872993a0a 100644 --- a/.github/workflows/release-docker-images.yml +++ b/.github/workflows/release-docker-images.yml @@ -26,13 +26,19 @@ jobs: with: ref: ${{ steps.extract_branch.outputs.branch }} - - name: Login to Docker Hub + - name: Login to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.CR_PAT }} + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + - name: Build full project via docker-compose run: | mv example.env .env @@ -40,5 +46,14 @@ jobs: sed -i 's/compdem/civictechto/g' docker-compose.yml docker compose --profile postgres build --parallel --build-arg GIT_HASH=${GITHUB_SHA:0:6} - - name: Push images to Docker Hub + - name: Push images to GHCR run: docker compose --profile postgres push --ignore-push-failures + + - name: Push images to Docker Hub + run: | + for image in $(docker images --format='{{.Repository}}:{{.Tag}}'); do + IMAGE_NAME=$(echo "$image" | sed 's/ghcr.io/docker.io/g') + IMAGE_NAME=$(echo "$IMAGE_NAME" | sed 's/civictechto/${{ secrets.DOCKER_USERNAME }}/g') + docker tag $image $IMAGE_NAME + done + docker compose --profile postgres push --ignore-push-failures