Skip to content

Commit

Permalink
Merge pull request #2 from fga-eps-mds/devops/fixes-pipeline
Browse files Browse the repository at this point in the history
Corrige trigger de pipeline de commit de métricas
  • Loading branch information
VictorJorgeFGA authored Sep 18, 2024
2 parents 90d39c7 + 87c9fc6 commit a1053a9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 12 deletions.
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 }}

0 comments on commit a1053a9

Please sign in to comment.