Skip to content

Publish Frontend Image #8

Publish Frontend Image

Publish Frontend Image #8

Workflow file for this run

name: Publish Frontend Image
on:
release:
types:
- published
workflow_dispatch:
env:
DOCKER_REPO: lofowebteam/tpc_portal_frontend
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.DOCKER_REPO }}:${{ github.sha }},${{ env.DOCKER_REPO }}:latest
cache-from: type=registry,ref=${{ env.DOCKER_REPO }}:buildcache
cache-to: type=registry,ref=${{ env.DOCKER_REPO }}:buildcache,mode=max
bump_tag:
name: Bump tag into docker-compose.yml
needs: push_to_registry
runs-on: ubuntu-latest
steps:
- name: Checkout charts
uses: actions/checkout@v4
with:
repository: Web-Team-IITI-Gymkhana/tpc-pipeline-testing
ref: "main"
token: ${{ secrets.TPC_GITHUB_ACTION_ADMIN }}
path: base_dir
- name: Changing Chart version
uses: mikefarah/[email protected]
with:
cmd: yq -i '.services.frontend.image = "${{ env.DOCKER_REPO }}:${{ github.sha }}"' base_dir/docker-compose.yml
- name: Commit updated docker compose
run: |
cd base_dir
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add docker-compose.yml
git commit -m "[CI] Bump frontend image tag to ${{ github.sha }}"
git push