Skip to content

Update README.MD

Update README.MD #1

name: Pet Store App CI/CD to Azure App Service
env:
AZURE_CONTAINER_REGISTRY: surajazurepetstorecr.azurecr.io
AZURE_CONTAINER_REGISTRY_USERNAME: Surajazurepetstorecr
on:
push:
branches:
- main
paths:
- petstore/petstoreapp/**
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checking the file system listing for Pet Store App
run: |
ls -al
- name: Update the version.json
run: echo -n -e "{\"version\":\"${{ github.sha }}\",\"date\":\"$(date '+%m-%d-%Y %H:%M:%S')\"}" > petstore/petstoreapp/src/main/resources/static/content/version.json
- run: cat petstore/petstoreapp/src/main/resources/static/content/version.json
- uses: actions/setup-java@v2
name: Building Pet Store App with Java 13
with:
java-version: '13'
distribution: 'adopt'
- name: Run Maven build
run: mvn -f petstore/petstoreapp/pom.xml --batch-mode --update-snapshots verify
- name: Upload Maven build artifact
uses: actions/upload-artifact@v1
with:
name: artifact
path: petstore/petstoreapp/target/petstoreapp-0.0.1-SNAPSHOT.jar
- uses: azure/docker-login@v1
name: Build Docker image
with:
login-server: ${{ env.AZURE_CONTAINER_REGISTRY }}
username: ${{ env.AZURE_CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.PETSTORECRSECRET }}
- name: Push Docker image to Azure Container Registry
run: |
docker build petstore/petstoreapp -t ${{env.AZURE_CONTAINER_REGISTRY}}/petstoreapp:latest -t ${{ env.AZURE_CONTAINER_REGISTRY }}/petstoreapp:${{ github.sha }}
docker push ${{ env.AZURE_CONTAINER_REGISTRY }}/petstoreapp:${{ github.sha }}
docker push ${{ env.AZURE_CONTAINER_REGISTRY }}/petstoreapp:latest