Skip to content

Commit

Permalink
Update workflows to push images to ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
bnallapeta committed Jun 21, 2024
1 parent 11b1c80 commit f9abbc4
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:
GOLANG_VERSION: 1.21
HELM_VERSION: v3.8.2
KIND_VERSION: "v0.17.0"
REGISTRY: ghcr.io

jobs:
build:
Expand Down Expand Up @@ -85,6 +86,35 @@ jobs:
with:
buildkitd-flags: --debug

- name: Login to ghcr registry
uses: docker/login-action@v3
with:
registry: ${{env.REGISTRY}}
username: stakater-user
password: ${{secrets.GITHUB_TOKEN}}

- name: Generate image repository path for ghcr registry
run: |
echo GHCR_IMAGE_REPOSITORY=${{env.REGISTRY}}/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build and Push image to ghcr registry
uses: docker/build-push-action@v5
with:
context: .
file: ${{ env.DOCKER_FILE_PATH }}
pull: true
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
platforms: linux/amd64,linux/arm,linux/arm64
tags: |
${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.new_tag }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Login to Registry
uses: docker/login-action@v3
with:
Expand Down
32 changes: 31 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ env:
KIND_VERSION: "v0.17.0"
HELM_REGISTRY_URL: "https://stakater.github.io/stakater-charts"
HELM_VERSION: v3.8.2
REGISTRY: ghcr.io

jobs:
build:
Expand Down Expand Up @@ -95,6 +96,35 @@ jobs:
with:
buildkitd-flags: --debug

- name: Login to ghcr registry
uses: docker/login-action@v3
with:
registry: ${{env.REGISTRY}}
username: stakater-user
password: ${{secrets.GITHUB_TOKEN}}

- name: Generate image repository path for ghcr registry
run: |
echo GHCR_IMAGE_REPOSITORY=${{env.REGISTRY}}/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build and Push image to ghcr registry
uses: docker/build-push-action@v5
with:
context: .
file: ${{ env.DOCKER_FILE_PATH }}
pull: true
push: true
cache-to: type=inline
cache-from: type=gha
build-args: BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
platforms: linux/amd64,linux/arm,linux/arm64
tags: |
${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.new_tag }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Login to Registry
uses: docker/login-action@v3
with:
Expand All @@ -105,7 +135,7 @@ jobs:
run: |
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build and push
- name: Build and push image to docker registry
uses: docker/build-push-action@v5
with:
context: .
Expand Down

0 comments on commit f9abbc4

Please sign in to comment.