Skip to content

Commit

Permalink
feat(gha): added ghcr container push
Browse files Browse the repository at this point in the history
  • Loading branch information
shinybrar committed Jun 29, 2024
1 parent faec81b commit f78275e
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
permissions:
contents: write
pull-requests: write
packages: write
attestations: write
id-token: write

jobs:
deployment:
Expand All @@ -33,30 +36,35 @@ jobs:
run: |
echo "Creating release tags for docker image"
IMAGE="chimefrb/workflow"
GHCR_IMAGE="ghcr.io/chimefrb/workflow"
TAG=${{ steps.release-please.outputs.tag_name }}
echo "image=${IMAGE}:latest" >> $GITHUB_OUTPUT
echo "tagged_image=${IMAGE}:${TAG}" >> $GITHUB_OUTPUT
-
name: Setup ssh-agent
id: ssh-agent-setup
if: ${{ steps.release-please.outputs.release_created }}
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.CHIMEFRB_BOT_SSH_PRIVATE_KEY }}
echo "ghcr_image=${GHCR_IMAGE}:latest" >> $GITHUB_OUTPUT
echo "ghcr_tagged_image=${GHCR_IMAGE}:${TAG}" >> $GITHUB_OUTPUT
-
name: Setup docker-buildx
id: buildx
if: ${{ steps.release-please.outputs.release_created }}
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
with:
install: true
-
name: Perform docker-login
name: Perform Dockerhub Login
if: ${{ steps.release-please.outputs.release_created }}
uses: docker/login-action@v3
with:
username: ${{ secrets.CHIMEFRB_DOCKER_USERNAME }}
password: ${{ secrets.CHIMEFRB_DOCKER_PASSWORD }}
-
name: Perform GHCR Login
if: ${{ steps.release-please.outputs.release_created }}
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build & Push docker image
id: build
Expand All @@ -70,6 +78,8 @@ jobs:
tags: |
${{ steps.metadata.outputs.image }}
${{ steps.metadata.outputs.tagged_image }}
${{ steps.metadata.outputs.ghcr_image }}
${{ steps.metadata.outputs.ghcr_tagged_image }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit f78275e

Please sign in to comment.