Skip to content

Merge pull request #644 from enshkn/development #56

Merge pull request #644 from enshkn/development

Merge pull request #644 from enshkn/development #56

Workflow file for this run

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy container app to Azure Web App - Dutluk
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu' # Alternative distribution options are available.
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
working-directory: ./dutluk/dutluk_backend
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=enshkn_BOUN-SWE-574-Fall-23-G2 -Dsonar.organization=enshkn
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to registry
uses: docker/login-action@v2
with:
registry: https://index.docker.io/v1/
username: ${{ secrets.AzureAppService_ContainerUsername_f03ae9c659ec4574af52b01c85839b3c }}
password: ${{ secrets.AzureAppService_ContainerPassword_cc5257e61f5744a199cb537357366552 }}
- name: Build and push container image to registry
uses: docker/build-push-action@v3
with:
push: true
tags: index.docker.io/${{ secrets.AzureAppService_ContainerUsername_f03ae9c659ec4574af52b01c85839b3c }}/dutluk-be-prod:${{ github.sha }}
file: ./dutluk/build_dockerfiles/backend/Dockerfile
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'Dutluk'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_d87eb81ee4ee4ab1a6a3f26d8c6dce79 }}
images: 'index.docker.io/${{ secrets.AzureAppService_ContainerUsername_f03ae9c659ec4574af52b01c85839b3c }}/dutluk-be-prod:${{ github.sha }}'