Pet Store App CI/CD to Azure App Service #2
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: Pet Store App CI/CD to Azure App Service | |
env: | |
AZURE_CONTAINER_REGISTRY: taeazurepetstorecr.azurecr.io | |
AZURE_CONTAINER_REGISTRY_USERNAME: taeazurepetstorecr | |
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: Build the Soul Machines React app | |
run: | | |
cd petstore/petstoreapp/soulmachines-react-app | |
npm install | |
npm run build | |
- name: Copy minified Soul Machines React app to Spring Boot static resources | |
run: | | |
mv petstore/petstoreapp/soulmachines-react-app/build/static/ petstore/petstoreapp/src/main/resources/static | |
mv petstore/petstoreapp/soulmachines-react-app/build/index.html petstore/petstoreapp/src/main/resources/static/static | |
- 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 | |