Docker Image CI #12
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: Docker Image CI | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag Number' | |
type: string | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
context: fastapi-hello-world | |
tags: malaysiaai/fastapi-hello-world:${{ inputs.tag }} | |
modify-manifest: | |
needs: [docker] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: modify the image tag | |
with: | |
repository: malaysia-ai/argocd | |
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT | |
- name: modify the image tag | |
run: | | |
git config user.email [email protected] | |
git config user.name Ariff Nazhan | |
pwd | |
cat | |
sed -i "s+malaysiaai/fastapi-hello-world:0.0.1+malaysiaai/fastapi-hello-world:${inputs.tag}+g" fastapi-hello-world/deploy.yaml | |
git add fastapi-hello-world/deploy.yaml | |
git commit -m "Committed by Github Actions Job CI" | |
git push origin main | |