Skip to content

Commit

Permalink
Push docker image to ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Dec 20, 2023
1 parent 14fdfe0 commit f6053c4
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
env:
GO_VERSION: "1.21"
CI_REGISTRY_IMAGE: "${{ secrets.CI_REGISTRY }}/registration-relay"
GHCR_REGISTRY: ghcr.io
GHCR_REGISTRY_IMAGE: "ghcr.io/${{ github.repository }}"

jobs:
lint:
Expand All @@ -30,18 +32,32 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Beeper Docker registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.CI_REGISTRY }}
username: ${{ secrets.CI_REGISTRY_USER }}
password: ${{ secrets.CI_REGISTRY_PASSWORD }}

- name: Login to ghcr
uses: docker/login-action@v2
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@v2
with:
context: .
cache-from: ${{ env.CI_REGISTRY_IMAGE }}:latest
pull: true
tags: ${{ env.CI_REGISTRY_IMAGE }}:${{ github.sha }}
tags: |
${{ env.CI_REGISTRY_IMAGE }}:${{ github.sha }}
${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}
push: true

deploy-docker:
Expand All @@ -50,11 +66,24 @@ jobs:
needs:
- build-docker
steps:
- uses: docker/login-action@v2
- name: Login to Beeper Docker registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.CI_REGISTRY }}
username: ${{ secrets.CI_REGISTRY_USER }}
password: ${{ secrets.CI_REGISTRY_PASSWORD }}

- name: Login to ghcr
uses: docker/login-action@v2
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: beeper/docker-retag-push-latest@main
with:
image: ${{ env.CI_REGISTRY_IMAGE }}

- uses: beeper/docker-retag-push-latest@main
with:
image: ${{ env.GHCR_REGISTRY_IMAGE }}

0 comments on commit f6053c4

Please sign in to comment.