Skip to content

Merge pull request #26 from luisferrarezi/luisferrarezi-patch-6 #17

Merge pull request #26 from luisferrarezi/luisferrarezi-patch-6

Merge pull request #26 from luisferrarezi/luisferrarezi-patch-6 #17

Workflow file for this run

name: Deploy app Tiu Lanches
on:
push:
branches: [main]
jobs:
testes:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up JDK 21
uses: actions/[email protected]
with:
java-version: '21'
distribution: 'temurin'
server-id: github
settings-path: ${{ github.workspace }}
- name: Tests
run: mvn test
sonar:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up JDK 21
uses: actions/[email protected]
with:
java-version: '21'
distribution: 'temurin'
- name: SonarCloud Scan
run: mvn -B verify sonar:sonar -Dsonar.projectKey=luisferrarezi_tiulanches -Dsonar.organization=luisferrarezi -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/[email protected]
- name: Set up JDK 21
uses: actions/[email protected]
with:
java-version: '21'
distribution: 'temurin'
server-id: github
settings-path: ${{ github.workspace }}
- name: Build with Maven
run: mvn clean package
- name: ACR Login
uses: Azure/docker-login@v1
with:
username: ${{ secrets.USERNAME_ACR }}
password: ${{ secrets.PASSWORD_ACR }}
login-server: ${{ secrets.SERVER_ACR }}
- run: |
docker build . -t tiulanchesacr.azurecr.io/tiulanches:latest
docker push tiulanchesacr.azurecr.io/tiulanches:latest
deploy-aks:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Cria ConfigMap
run: |
touch configmap.yaml
cat > configmap.yaml << __EOF__
${{ env.CONFIG_MAP_YAML }}
__EOF__
- name: Azure Login
uses: Azure/[email protected]
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Azure Kubernetes set context
uses: Azure/aks-set-context@v3
with:
resource-group: ${{ secrets.RESOURSE_GROUP }}
cluster-name: ${{ secrets.CLUSTER_NAME }}
subscription: ${{ secrets.SUBSCRIPTION }}
- name: Deploy to Kubernetes cluster
uses: Azure/[email protected]
with:
manifests: |
configmap.yaml
kubernetes/azure/app-deployment.yaml