BAH-3528 | Add. Proxy Rules For uploaded-files (#14) #27
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: Build and Publish Proxy Image | |
on: | |
push: | |
branches: | |
- main | |
- 'release-*' | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
docker-build-publish: | |
name: Docker Build & Publish | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- 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: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Docker Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
no-cache: true | |
push: true | |
tags: bahmni/proxy:${{env.ARTIFACT_VERSION}},bahmni/proxy:latest | |
trigger: | |
name: Trigger auto deploy | |
runs-on: ubuntu-latest | |
needs: docker-build-publish | |
env: | |
ORG_NAME: Bahmni | |
REPOSITORY_NAME: bahmni-docker | |
EVENT_TYPE: bahmni-proxy-publish-event | |
steps: | |
- name: Create repository_dispatch | |
run: | | |
trigger_result=$(curl -s -o trigger_response.txt -w "%{http_code}" -X POST -H "Accept: application/vnd.github.v3+json" -H 'authorization: Bearer ${{ secrets.BAHMNI_PAT }}' https://api.github.com/repos/${ORG_NAME}/${REPOSITORY_NAME}/dispatches -d '{"event_type":"'"${EVENT_TYPE}"'"}') | |
if [ $trigger_result == 204 ];then | |
echo "Trigger to $ORG_NAME/$REPOSITORY_NAME Success" | |
else | |
echo "Trigger to $ORG_NAME/$REPOSITORY_NAME Failed" | |
cat trigger_response.txt | |
exit 1 | |
fi |