add new workflows #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Release and Deploy" | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "README.md" | |
env: | |
IMAGE_NAME: ghcr.io/${{ github.repository }} | |
IMAGE_PATH: ${{ github.repository }} | |
permissions: | |
id-token: write | |
contents: write | |
packages: write | |
jobs: | |
Docker-build: | |
name: Build and Push Short Sha Image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate tag | |
id: tag | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Build image | |
run: docker build . --file Dockerfile --tag $IMAGE_NAME:${{ steps.tag.outputs.sha_short }} --label "runnumber=${GITHUB_RUN_ID}" | |
- name: Log into registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Push image | |
run: docker push $IMAGE_NAME:${{ steps.tag.outputs.sha_short }} | |
outputs: | |
docker_tag: ${{ steps.tag.outputs.sha_short }} | |
# Conventional-release: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout Code | |
# uses: actions/checkout@v3 | |
# with: | |
# fetch-depth: 0 | |
# - name: Release | |
# id: tag | |
# uses: liatrio/github-actions/conventional-release@master | |
# with: | |
# debug: true | |
# # GITHUB_HEAD_REF is only set during PRs, otherwise it is "" | |
# dryRun: ${{ github.head_ref }} | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# outputs: | |
# newVersion: ${{ steps.tag.outputs.newVersion }} | |
# Docker-tag: | |
# runs-on: ubuntu-latest | |
# #needs: Conventional-release | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Log into registry | |
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
# - name: Semantic Version Tag image | |
# run: docker image tag $IMAGE_NAME:${{ steps.tag.outputs.sha_short }} $IMAGE_NAME:${{ steps.tag.outputs.newVersion }} | |
# - name: Semantic Version Tag image | |
# run: docker image tag $IMAGE_NAME:${{ steps.tag.outputs.sha_short }} $IMAGE_NAME:latest | |
# # only run on changes to infra/* | |
# Terraform-apply: | |
# name: "Terraform Apply" | |
# runs-on: ubuntu-latest | |
# if: ${{ github.event_name == 'push' && contains(github.event.commits.*.added, 'infra/') || contains(github.event.commits.*.modified, 'infra/') }} | |
# environment: | |
# name: "nonprod" | |
# needs: Conventional-release | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# - name: Setup Terragrunt | |
# run: | | |
# wget https://github.com/gruntwork-io/terragrunt/releases/download/v0.45.11/terragrunt_linux_amd64 | |
# sudo mv terragrunt_linux_amd64 /usr/local/bin/terragrunt | |
# sudo chmod +x /usr/local/bin/terragrunt | |
# - name: Plan LLM Slackbot poc deployment | |
# id: plan_llmslackbot_poc_deployment | |
# working-directory: infra/tg | |
# run: | | |
# terragrunt apply --terragrunt-non-interactive -auto-approve | |
# env: | |
# ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
# ARM_TENANT_ID: "1b4a4fed-fed8-4823-a8a0-3d5cea83d122" | |
# ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SPONSORED_SUBSCRIPTION_ID }} | |
# ARM_USE_OIDC: true | |
# TF_VAR_image_tag: ${{ steps.tag.outputs.newVersion }} | |
Deploy-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
needs: Docker-build | |
env: | |
IMAGE_VERSION: ${{ needs.Docker-build.outputs.docker_tag }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Update webapp | |
run: echo "fake update web app to version:${IMAGE_VERSION}" | |
# - name: Update webapp | |
# uses: azure/webapps-deploy@v2 | |
# with: | |
# app-name: 'liatrio-llm-web-app' | |
# publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
# images: ghcr.io/${{ github.repository }}:${{ needs.Docker-build.outputs.docker_tag }} |