Skip to content

Commit 7cd6c97

Browse files
committed
fix: correção de sintaxe no workflow
1 parent 9c0b4f5 commit 7cd6c97

File tree

10 files changed

+172
-439
lines changed

10 files changed

+172
-439
lines changed

.github/workflows/cd-pipeline.yml

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,48 @@ on:
33
push:
44
tags:
55
- 'v*.*.*'
6+
67
jobs:
8+
tests:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code - Tests
12+
uses: actions/checkout@v5
13+
14+
- name: Build and run tests
15+
run: docker build --target tests --progress=plain -t riber-tests .
16+
717
deploy:
818
runs-on: ubuntu-latest
19+
needs: tests
920
steps:
10-
- name: Checkout code
11-
uses: actions/checkout@v4
21+
- name: Checkout code - Deploy
22+
uses: actions/checkout@v5
1223

1324
- name: Get version
1425
id: image
1526
run: |
1627
VERSION=$(grep '<Version>' Directory.Build.props | sed 's/.*<Version>\(.*\)<\/Version>.*/\1/')
1728
echo "version=$VERSION" >> $GITHUB_OUTPUT
18-
29+
30+
- name: Lowercase repository owner
31+
id: repo
32+
run: echo "owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
33+
1934
- name: Login to GHCR
20-
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
35+
uses: docker/login-action@v3
2136
with:
2237
registry: ghcr.io
23-
username: ${{ github.repository_owner }}
38+
username: ${{ github.actor }}
2439
password: ${{ secrets.GHCR }}
2540

2641
- name: Build and push to GHCR
27-
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
42+
uses: docker/build-push-action@v6
2843
with:
2944
context: .
3045
push: true
3146
platforms: linux/amd64
47+
target: runtime
3248
tags: |
33-
ghcr.io/${{ github.repository_owner }}/riber:latest
34-
ghcr.io/${{ github.repository_owner }}/riber:${{ steps.image.outputs.version }}
35-
#
36-
# - name: Deploy to AWS EC2
37-
# uses: appleboy/ssh-action@v1.0.3
38-
# with:
39-
# host: ${{ secrets.EC2_HOST }}
40-
# username: ${{ secrets.EC2_USERNAME }}
41-
# key: ${{ secrets.EC2_KEY }}
42-
# script: |
43-
# echo "${{ secrets.GHCR }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
44-
# docker pull ghcr.io/${{ github.repository_owner }}/riber:${{ steps.image.outputs.version }}
45-
#
46-
# docker stop riber-api || true
47-
# docker rm riber-api || true
48-
#
49-
# docker run -d --name riber-api -p 80:8080 --restart unless-stopped \
50-
# -e ConnectionStrings__DefaultConnection="${{ secrets.CONNECTION_STRING }}" \
51-
# -e AccessTokenSettings__SecretKey="${{ secrets.ACCESS_TOKEN_SECRET_KEY }}" \
52-
# -e RefreshTokenSettings__SecretKey="${{ secrets.REFRESH_TOKEN_SECRET_KEY }}" \
53-
# -e AWS__S3__BucketImagesName="${{ secrets.S3_BUCKET_IMAGES_NAME }}" \
54-
# ghcr.io/${{ github.repository_owner }}/riber:${{ steps.image.outputs.version }}
55-
#
56-
# docker images | grep riber | tail -n +4 | awk '{print $3}' | xargs -r docker rmi || true
49+
ghcr.io/${{ steps.repo.outputs.owner }}/riber:latest
50+
ghcr.io/${{ steps.repo.outputs.owner }}/riber:${{ steps.image.outputs.version }}

.github/workflows/ci-pipeline.yml

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,25 @@ name: CI Pipeline
22
on:
33
pull_request:
44
branches: [ main ]
5+
paths: [ "src/**", "tests/**", ".github/**" ]
56
push:
67
branches: [ main ]
7-
paths:
8-
- "src/**"
9-
- "tests/**"
10-
- ".github/**"
8+
paths: [ "src/**", "tests/**", ".github/**" ]
119

1210
jobs:
1311
test-and-build:
1412
if: github.event_name == 'pull_request'
1513
runs-on: ubuntu-latest
1614
steps:
1715
- name: Checkout code
18-
uses: actions/checkout@v4
16+
uses: actions/checkout@v5
1917

20-
- name: Setup .NET 9
21-
uses: actions/setup-dotnet@v4
18+
- name: Setup .NET 10
19+
uses: actions/setup-dotnet@v5
2220
with:
23-
dotnet-version: '9.0.x'
21+
dotnet-version: '10.0.x'
2422

25-
- uses: actions/cache@v3
23+
- uses: actions/cache@v4
2624
with:
2725
path: ~/.nuget/packages
2826
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
@@ -49,22 +47,21 @@ jobs:
4947

5048
steps:
5149
- name: Checkout code
52-
uses: actions/checkout@v4
50+
uses: actions/checkout@v5
5351
with:
54-
fetch-depth: 0 # Baixa o histórico de commits do repositório
52+
fetch-depth: 0
5553

56-
- name: Setup .NET 9
57-
uses: actions/setup-dotnet@v4
54+
- name: Setup .NET 10
55+
uses: actions/setup-dotnet@v5
5856
with:
59-
dotnet-version: '9.0.x'
57+
dotnet-version: '10.0.x'
6058

6159
- name: Cache SonarCloud packages
6260
uses: actions/cache@v4
6361
with:
64-
path: ~/.sonar/cache # pasta onde irá ficar guardado o cache
65-
# runner.os = pega o nome do sistema operacional
66-
key: ${{ runner.os }}-sonar # Nome único para identificar o cache
67-
restore-keys: ${{ runner.os }}-sonar # Chave alternativa se não encontrar a principal
62+
path: ~/.sonar/cache
63+
key: ${{ runner.os }}-sonar
64+
restore-keys: ${{ runner.os }}-sonar
6865

6966
- name: Install SonarScanner
7067
run: dotnet tool install --global dotnet-sonarscanner
@@ -82,7 +79,6 @@ jobs:
8279

8380
- name: Run analisys with SonarScanner
8481
env:
85-
CI: true
8682
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8783
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
8884
SONAR_PROJECT_KEY: "${{ github.repository_owner }}_riber"

CHANGELOG.md

Lines changed: 0 additions & 237 deletions
This file was deleted.

0 commit comments

Comments
 (0)