Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrige trigger de pipeline de commit de métricas #2

Merged
merged 2 commits into from
Sep 18, 2024
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
31 changes: 31 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Aqui realizamos o deploy do microserviço fazendo push da imagem docker atualizada
# com a versão mais recente do código para o Dockerhub. Depois fazemos o deploy no EC2
# que nada mais é que um git pull e restartar os containers do micro-serviço
#
# Nesse mesmo workflow temos a action de release, que cria uma release no github
# caso seja feito um push de tag com nome no formato vX.Y.Z
#
name: Deploy

on:
Expand Down Expand Up @@ -45,3 +52,27 @@ jobs:
cd ${{env.TARGET_DIR}}
sudo git pull
sudo docker compose -f docker-compose.prod.yml up --force-recreate --build --pull always --remove-orphans -d

release:
name: Release
runs-on: 'ubuntu-latest'
steps:
- name: Create Release
if: startsWith(github.ref, 'refs/tags')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false

- name: Envia métricas como assets da release
if: startsWith(github.ref, 'refs/tags')
uses: AButler/[email protected]
with:
files: 'analytics-raw-data/*'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.ref_name }}
20 changes: 8 additions & 12 deletions .github/workflows/metrics.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Aqui buscamos no Sonar um relatório em formato JSON
# e enviamos para o repositório de DOC.

name: Export de métricas

on:
push:
branches: [main, develop]
tags:
- "v*"
pull_request: # TODO: revisitar isso aqui. Garantir o envio do JSON no sonar na Release
branches:
- main
- develop
types: [closed]

jobs:
release:
Expand All @@ -30,11 +34,3 @@ jobs:
git add .
git commit -m "Adicionando métricas do repositório ${{ github.event.repository.name }} ${{ github.ref_name }}"
git push

- name: Envia métricas como assets da release
if: startsWith(github.ref, 'refs/tags')
uses: AButler/[email protected]
with:
files: 'analytics-raw-data/*'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.ref_name }}
Loading