feat: update location mediator to create locations AB#18688 #46
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 Process | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout master | |
uses: actions/checkout@main | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.docker | |
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }} | |
restore-keys: | | |
${{ runner.os }}-docker- | |
# - name: SonarQube Scan | |
# uses: sonarsource/sonarqube-scan-action@master | |
# env: | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
# SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
# If you wish to fail your job when the Quality Gate is red, uncomment the | |
# following lines. This would typically be used to fail a deployment. | |
# - uses: sonarsource/sonarqube-quality-gate-action@master | |
# timeout-minutes: 5 | |
# env: | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build container image | |
run: docker build -t ${{ secrets.REGISTRY_NAME }}/openimis-mediator:$(echo $GITHUB_SHA | head -c7) . | |
- name: Push image to dockerhub Container Registry | |
run: docker push ${{ secrets.REGISTRY_NAME }}/openimis-mediator:$(echo $GITHUB_SHA | head -c7) | |
- name: Update deployment file | |
run: TAG=$(echo $GITHUB_SHA | head -c7) && sed -i 's|<IMAGE>|${{ secrets.REGISTRY_NAME }}/openimis-mediator:'${TAG}'|' $GITHUB_WORKSPACE/kubernetes/deployment.yaml | |
- name: Install doctl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{secrets.DIGITALOCEAN_ACCESS_TOKEN}} | |
- name: Set up kubectl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
k8s_version: "latest" | |
- name: Configure kubectl | |
run: | | |
doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ secrets.CLUSTER_NAME }} | |
- name: Deploy to Kubernetes | |
run: | | |
kubectl apply -f $GITHUB_WORKSPACE/kubernetes/deployment.yaml | |
- name: Verify deployment | |
run: | | |
kubectl rollout status deployment/openimis-mediator -n staging |