Skip to content

Update main.yml

Update main.yml #7

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches:
- main
- 'feature-**'
tags:
- '*'
workflow_dispatch:
inputs:
ref:
description: "Why trigger?"
required: true
type: string
env:
IMAGE: "khulnasoft-init-grafana-ds-dh"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: "ghcr.io"
username: "${{ github.repository_owner }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: Log in to Docker Registry
uses: docker/login-action@v2
with:
username: "khulnasoft"
password: "${{ secrets.REGISTRY_PASS }}"
- name: set env
run: |
echo "IMAGE_TAG_PREFIX=${{ github.ref_name }}"|sed 's|main|latest|' >> $GITHUB_ENV
echo "IMAGE_TAG=$(git rev-list --count HEAD)" >> $GITHUB_ENV
- name: Build and push khulnasoft-init-grafana images to ghcr and dockerhub
uses: docker/build-push-action@v2
with:
context: .
push: true
file: Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
"ghcr.io/${{ github.repository_owner }}/khulnasoft-ce/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}-${{ env.IMAGE_TAG }}"
"ghcr.io/${{ github.repository_owner }}/khulnasoft-ce/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}"
"khulnasoft/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}"
- name: Build and push khulnasoft agent images to beijing aliyun
uses: docker/build-push-action@v2
with:
context: .
push: true
file: Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
"ghcr.io/khulnasoft/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}-${{ env.IMAGE_TAG }}"
"ghcr.io/khulnasoft/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}"
- name: Build and push khulnasoft agent images to beijing aliyun
uses: docker/build-push-action@v2
with:
context: .
push: true
file: Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
"ghcr.io/khulnasoft/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}-${{ env.IMAGE_TAG }}"
"ghcr.io/khulnasoft/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}"