Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: Added the github actions to support release tag #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 65 additions & 19 deletions .github/workflows/agent-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,82 @@ name: Agent Docker Image CI
on:
push:
paths-ignore:
- 'charts/**'
- '**.md'
branches: [ main ]
- 'charts/**'
branches:
- 'main'
tags:
- 'v*.*.*'
pull_request:
paths-ignore:
- 'helm/**'
- '**.md'
branches: [ main ]
branches:
- 'main'

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
IMAGE: ${{ github.repository }}/agent

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file dockerfiles/agent/Dockerfile --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/agent:latest
- name: Docker push
run: |
docker login ${{ env.REGISTRY }} -u jebinjeb -p ${{ secrets.GITHUB_TOKEN }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/agent:latest
if: github.event_name == 'push'

-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

-
name: Set up QEMU
uses: docker/setup-qemu-action@v2

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


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

-
name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
latest # Add the "latest" tag

-
name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./dockerfiles/agent/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
"GITHUB_TOKEN=${{ secrets.TOKEN }}"

-
name: Build and push on PR
uses: docker/build-push-action@v4
if: github.event_name == 'pull_request'
with:
context: .
file: ./dockerfiles/agent/Dockerfile
push: false
tags: ${{ env.REGISTRY }}/${{ env.IMAGE }}:pr-${{ github.event.pull_request.number }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
"GITHUB_TOKEN=${{ secrets.TOKEN }}"