Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 24 additions & 30 deletions .github/workflows/cd-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,48 @@ on:
push:
tags:
- 'v*.*.*'

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code - Tests
uses: actions/checkout@v5

- name: Build and run tests
run: docker build --target tests --progress=plain -t riber-tests .

deploy:
runs-on: ubuntu-latest
needs: tests
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout code - Deploy
uses: actions/checkout@v5

- name: Get version
id: image
run: |
VERSION=$(grep '<Version>' Directory.Build.props | sed 's/.*<Version>\(.*\)<\/Version>.*/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT


- name: Lowercase repository owner
id: repo
run: echo "owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT

- name: Login to GHCR
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR }}

- name: Build and push to GHCR
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64
target: runtime
tags: |
ghcr.io/${{ github.repository_owner }}/riber:latest
ghcr.io/${{ github.repository_owner }}/riber:${{ steps.image.outputs.version }}
#
# - name: Deploy to AWS EC2
# uses: appleboy/ssh-action@v1.0.3
# with:
# host: ${{ secrets.EC2_HOST }}
# username: ${{ secrets.EC2_USERNAME }}
# key: ${{ secrets.EC2_KEY }}
# script: |
# echo "${{ secrets.GHCR }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
# docker pull ghcr.io/${{ github.repository_owner }}/riber:${{ steps.image.outputs.version }}
#
# docker stop riber-api || true
# docker rm riber-api || true
#
# docker run -d --name riber-api -p 80:8080 --restart unless-stopped \
# -e ConnectionStrings__DefaultConnection="${{ secrets.CONNECTION_STRING }}" \
# -e AccessTokenSettings__SecretKey="${{ secrets.ACCESS_TOKEN_SECRET_KEY }}" \
# -e RefreshTokenSettings__SecretKey="${{ secrets.REFRESH_TOKEN_SECRET_KEY }}" \
# -e AWS__S3__BucketImagesName="${{ secrets.S3_BUCKET_IMAGES_NAME }}" \
# ghcr.io/${{ github.repository_owner }}/riber:${{ steps.image.outputs.version }}
#
# docker images | grep riber | tail -n +4 | awk '{print $3}' | xargs -r docker rmi || true
ghcr.io/${{ steps.repo.outputs.owner }}/riber:latest
ghcr.io/${{ steps.repo.outputs.owner }}/riber:${{ steps.image.outputs.version }}
34 changes: 15 additions & 19 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,25 @@ name: CI Pipeline
on:
pull_request:
branches: [ main ]
paths: [ "src/**", "tests/**", ".github/**" ]
push:
branches: [ main ]
paths:
- "src/**"
- "tests/**"
- ".github/**"
paths: [ "src/**", "tests/**", ".github/**" ]

jobs:
test-and-build:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup .NET 9
uses: actions/setup-dotnet@v4
- name: Setup .NET 10
uses: actions/setup-dotnet@v5
with:
dotnet-version: '9.0.x'
dotnet-version: '10.0.x'

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

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0 # Baixa o histórico de commits do repositório
fetch-depth: 0

- name: Setup .NET 9
uses: actions/setup-dotnet@v4
- name: Setup .NET 10
uses: actions/setup-dotnet@v5
with:
dotnet-version: '9.0.x'
dotnet-version: '10.0.x'

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

- name: Install SonarScanner
run: dotnet tool install --global dotnet-sonarscanner
Expand All @@ -82,7 +79,6 @@ jobs:

- name: Run analisys with SonarScanner
env:
CI: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_PROJECT_KEY: "${{ github.repository_owner }}_riber"
Expand Down
237 changes: 0 additions & 237 deletions CHANGELOG.md

This file was deleted.

Loading
Loading