Skip to content

Commit

Permalink
Merge pull request #597 from stakater/ghcr-image
Browse files Browse the repository at this point in the history
 Update workflows to push images to ghcr
  • Loading branch information
bnallapeta committed Jun 21, 2024
2 parents 11b1c80 + 709536c commit 865f33a
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 6 deletions.
36 changes: 33 additions & 3 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,17 +86,46 @@ jobs:
with:
buildkitd-flags: --debug

- name: Login to Registry
- 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 DockerHub Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.STAKATER_DOCKERHUB_USERNAME }}
password: ${{ secrets.STAKATER_DOCKERHUB_PASSWORD }}

- name: Generate image repository path
- name: Generate image repository path for dockerhub registry
run: |
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build and push
- name: Build and push to DockerHub registry
uses: docker/build-push-action@v5
with:
context: .
Expand Down
36 changes: 33 additions & 3 deletions .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,17 +96,46 @@ jobs:
with:
buildkitd-flags: --debug

- name: Login to Registry
- 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 Dockerhub Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.STAKATER_DOCKERHUB_USERNAME }}
password: ${{ secrets.STAKATER_DOCKERHUB_PASSWORD }}

- name: Generate image repository path
- name: Generate image repository path for DockerHub registry
run: |
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build and push
- name: Build and push image to DockerHub registry
uses: docker/build-push-action@v5
with:
context: .
Expand Down

0 comments on commit 865f33a

Please sign in to comment.