Skip to content

Merge pull request #506 from atharvatechnology/dev #25

Merge pull request #506 from atharvatechnology/dev

Merge pull request #506 from atharvatechnology/dev #25

name: CI/CD to Yeti
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build:
name: Build and Push Image
runs-on: ubuntu-latest
outputs:
img_tag: ${{ steps.docker_meta.outputs.tags }}
json_tag: ${{ steps.docker_meta.outputs.json }}
steps:
- name: Check out
uses: actions/checkout@v3
- name: Docker Meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v4
with:
images: ghcr.io/atharvatechnology/apex-backend
tags: |
type=sha
# type=sha,format=long
- name: Login to ghcr
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
deploy:
name: Deploy to Yeti instance
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: 'actions/checkout@v3'
- name: Echo
env:
TAG: ${{ fromJSON(needs.build.outputs.json_tag).tags[0] }}
run: |
IFS=: read -r dummy shaVal <<< $TAG
echo "SHA_TAG=$shaVal" >> $GITHUB_ENV
- name: 'Authenticate to Yeti Cloud'
uses: 'DovnarAlexander/github-actions-jelastic@master'
with:
envs: GITHUB_SHA
jelastic_url: app.yetiapp.cloud
jelastic_username: ${{ secrets.JELASTIC_USERNAME }}
jelastic_password: ${{ secrets.JELASTIC_TOKEN }}
task: environment/control/redeploycontainers --envName ${{ secrets.JELASTIC_ENV }} --nodeGroup ${{ secrets.JELASTIC_NODE_GROUP }} --tag ${{ env.SHA_TAG }}