Skip to content

Commit

Permalink
add quay and release jobs
Browse files Browse the repository at this point in the history
Signed-off-by: Mahendra Paipuri <[email protected]>
  • Loading branch information
mahendrapaipuri committed Apr 22, 2024
1 parent dae687c commit 5e83792
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 12 deletions.
27 changes: 19 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ on:
type: string
description: DockerHub organization
default: mahendrapaipuri
quay_registry:
type: string
description: Quay registry
default: quay.io
quay_organization:
type: string
description: Quay organization
default: mahendrapaipuri
push:
paths:
- "go.sum"
Expand Down Expand Up @@ -65,11 +73,14 @@ jobs:
login: ${{ secrets.DOCKER_HUB_LOGIN }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}

# quay:
# needs: [build]
# uses: ./.github/workflows/step_quay.yml
# with:
# registry: "quay.io"
# organization: ${{ inputs.quay_organization }}
# login: ${{ secrets.quay_login }}
# password: ${{ secrets.quay_password }}
quay:
needs: [build]
uses: ./.github/workflows/step_docker.yml
# Since workflow_dispatch inputs are only available on manual triggers
# we need to set default values to the context vars here
with:
registry: ${{ inputs.quay_registry || 'quay.io' }}
organization: ${{ inputs.quay_organization || 'mahendrapaipuri' }}
secrets:
login: ${{ secrets.QUAY_LOGIN }}
password: ${{ secrets.QUAY_PASSWORD }}
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
name: Release

on:
workflow_dispatch:
inputs:
docker_hub_registry:
type: string
description: DockerHub registry
default: docker.io
docker_hub_organization:
type: string
description: DockerHub organization
default: mahendrapaipuri
quay_registry:
type: string
description: Quay registry
default: quay.io
quay_organization:
type: string
description: Quay organization
default: mahendrapaipuri
push:
# Run workflow on new tags
tags:
Expand Down Expand Up @@ -33,6 +51,30 @@ jobs:
needs: [cross-build]
uses: ./.github/workflows/step_packaging.yml

publish-docker-images:
needs: [cross-build]
uses: ./.github/workflows/step_docker.yml
# Since workflow_dispatch inputs are only available on manual triggers
# we need to set default values to the context vars here
with:
registry: ${{ inputs.quay_registry || 'docker.io' }}
organization: ${{ inputs.quay_organization || 'mahendrapaipuri' }}
secrets:
login: ${{ secrets.DOCKER_HUB_LOGIN }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}

publish-quay-images:
needs: [cross-build]
uses: ./.github/workflows/step_docker.yml
# Since workflow_dispatch inputs are only available on manual triggers
# we need to set default values to the context vars here
with:
registry: ${{ inputs.quay_registry || 'quay.io' }}
organization: ${{ inputs.quay_organization || 'mahendrapaipuri' }}
secrets:
login: ${{ secrets.QUAY_LOGIN }}
password: ${{ secrets.QUAY_PASSWORD }}

publish:
needs: [packaging]
runs-on: ubuntu-latest
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/step_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,23 @@ jobs:
- name: Build container images
run: |
ls -la .build/linux-amd64
ls -la .build/linux-arm64
chmod +x -R .build
make docker DOCKER_IMAGE_TAG=${{ steps.target_branch.outputs.name }} DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
docker images
- name: Test container images
run: make test-docker DOCKER_IMAGE_TAG=${{ steps.target_branch.outputs.name }} DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}

- name: Publish image for main branch
- name: Publish image for current branch/tag
if: github.ref == 'refs/heads/main'
run: |
echo ${{ secrets.password }} | docker login -u ${{ secrets.login }} --password-stdin ${{ inputs.registry }}
make docker-publish DOCKER_IMAGE_TAG=${{ steps.target_branch.outputs.name }} DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
make docker-manifest DOCKER_IMAGE_TAG=${{ steps.target_branch.outputs.name }} DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
- name: Publish image with latest tag
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
run: |
echo ${{ secrets.password }} | docker login -u ${{ secrets.login }} --password-stdin ${{ inputs.registry }}
make docker-tag-latest DOCKER_IMAGE_TAG=${{ steps.target_branch.outputs.name }} DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
make docker-publish DOCKER_IMAGE_TAG=latest DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
make docker-manifest DOCKER_IMAGE_TAG=latest DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}

0 comments on commit 5e83792

Please sign in to comment.