fix: treat code to accept null image #20
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: .NET | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: | |
name: actions_back_front_orange_finance | |
steps: | |
# 1. Checkout do código | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
# 2. Semantic Release (opcional, caso utilize) | |
- name: Semantic Release | |
uses: cycjimmy/semantic-release-action@v4 | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
# 3. Configurar .NET | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.x | |
# 4. Restaurar dependências | |
- name: Restore dependencies | |
run: dotnet restore Back-Orange-Finance/Orange-Finance/OrangeFinance.csproj | |
# 5. Construir aplicação | |
- name: Build application | |
run: dotnet build Back-Orange-Finance/Orange-Finance/OrangeFinance.csproj --no-restore --configuration Release | |
# 6. Publicar aplicação | |
- name: Publish application | |
run: dotnet publish Back-Orange-Finance/Orange-Finance/OrangeFinance.csproj --no-build --configuration Release -o out | |
# 7. Fazer login no DockerHub | |
- name: Log in to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# 8. Construir e enviar a imagem Docker | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: Back-Orange-Finance | |
file: Back-Orange-Finance/Orange-Finance/Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/orange-finance-backend:latest | |
# 9. Varredura de vulnerabilidades na imagem Docker (opcional) | |
- name: Scan Docker image for vulnerabilities | |
uses: aquasecurity/[email protected] | |
with: | |
image-ref: ${{ secrets.DOCKER_USERNAME }}/orange-finance-backend:latest |