Skip to content

new realise

new realise #52

Workflow file for this run

name: KBOT-CICD
on:
push:
branches:
- main
jobs:
ci:
name: CI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run test
run: make test
- name: Docker Hub Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & Push Docker image
env:
APP: "kbot"
REGISTRY: ghcr.io/yuriikosiy
VERSION: $(git describe --tags --abbrev=0)-$(git rev-parse --short HEAD)
run: make image push
- name: Set VERSION
run: echo "VERSION=$(git describe --tags --abbrev=0)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build & Push Docker image to Docker Hub
env:
APP: "kbot"
VERSION: ${{ env.VERSION }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
run: |
docker build -t ${DOCKERHUB_USERNAME}/${APP}:${VERSION}-amd64 .
docker push ${DOCKERHUB_USERNAME}/${APP}:${VERSION}-amd64
cd:
name: CD
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: echo "VERSION=$(git describe --tags --abbrev=0)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: mikefarah/yq@master
with:
cmd: yq -i '.image.tag=strenv(VERSION)' helm/values.yaml
- run: |
git config user.name github-actions
git config user.email [email protected]
git add helm/values.yaml
git commit -m "Updated Helm chart with new image tag $VERSION-linux-amd64"
git push