Skip to content

[Rahul] | BAH-4097 | Add. Tag Based Trigger And Version Script To Bui… #25

[Rahul] | BAH-4097 | Add. Tag Based Trigger And Version Script To Bui…

[Rahul] | BAH-4097 | Add. Tag Based Trigger And Version Script To Bui… #25

name: Build and Publish atomfeed-console Image
on:
push:
branches: [master]
tags:
- '[0-9]+.[0-9]+.[0-9]+'
paths:
- 'atomfeed-console/**'
- '.github/workflows/atomfeed_console_build_publish.yaml'
repository_dispatch:
types:
- atomfeed-console-trigger
jobs:
Trivy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Trivy Scan
run: ./.github/trivy_scan.sh atomfeed-console .github/workflows/atomfeed_console_build_publish.yaml
docker-build-publish:
name: Docker Build & Publish
runs-on: ubuntu-latest
needs: Trivy
steps:
- uses: actions/checkout@v4
- name: Set env.ARTIFACT_VERSION
run: |
wget -q https://raw.githubusercontent.com/Bahmni/bahmni-infra-utils/main/setArtifactVersion.sh && chmod +x setArtifactVersion.sh
./setArtifactVersion.sh
rm setArtifactVersion.sh
- name: Download atomfeed-console jar
run: |
curl -H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/ICT4H/atomfeed-console/actions/artifacts | \
jq -r '.artifacts[0].archive_download_url' | \
xargs curl -L -o atomfeed-console-SNAPSHOT.zip -H "Authorization: token ${{secrets.BAHMNI_PAT}}"
unzip atomfeed-console-SNAPSHOT.zip -d atomfeed-console/resources/
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Docker Build and push
uses: docker/build-push-action@v2
with:
context: atomfeed-console/
no-cache: true
push: true
tags: bahmni/atomfeed-console:${{env.ARTIFACT_VERSION}},bahmni/atomfeed-console:latest