Skip to content

Commit

Permalink
ci: Update dotnet.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
adolfosp authored Jan 27, 2025
1 parent e8abe6d commit 1dd4ee5
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,54 +13,49 @@ jobs:
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
id: semantic_release
uses: cycjimmy/semantic-release-action@v4
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

# 3. Configurar .NET
- name: Extract and format release version
run: echo "NEXT_VERSION=${{ steps.semantic_release.outputs.newReleaseVersion#v }}" | sed 's/^v//' >> $GITHUB_ENV

- 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:{{env.NEXT_RELEASE_VERSION}}
tags: ${{ secrets.DOCKER_USERNAME }}/orange-finance-backend:${{ env.NEXT_VERSION }}

# 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:{{env.NEXT_RELEASE_VERSION}}
image-ref: ${{ secrets.DOCKER_USERNAME }}/orange-finance-backend:${{ env.NEXT_VERSION }}

0 comments on commit 1dd4ee5

Please sign in to comment.