Skip to content

Commit bcaa20a

Browse files
committed
feat: adjust workflows
1 parent 01a6622 commit bcaa20a

12 files changed

+247
-147
lines changed

.github/commitsar.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
verbose: true
2+
commits:
3+
strict: false
4+
limit: 100
5+
all: true
6+
upstreamBranch: origin/main

.github/release-please-config.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
"draft": false,
99
"prerelease": false,
1010
"release-type": "simple",
11-
"extra-files": [
12-
"variables.tf"
13-
],
1411
"changelog-sections": [
1512
{
1613
"type": "feat",

.github/workflows/add-to-project.yaml

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

.github/workflows/commits-checks.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: 'deploy-applications'
2+
3+
on:
4+
pull_request:
5+
# Executa em PRs para validação
6+
push:
7+
tags:
8+
- 'v*' # Trigger a build when a version tag is pushed
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
terraform:
15+
name: 'Terraform'
16+
runs-on: ubuntu-latest
17+
if: ${{ !startsWith(github.head_ref, 'release-please--') }}
18+
19+
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
20+
defaults:
21+
run:
22+
shell: bash
23+
24+
steps:
25+
# Checkout the repository to the GitHub Actions runner
26+
- name: Checkout
27+
uses: actions/checkout@v6
28+
29+
# Load all Terraform variables from a single JSON secret
30+
# The secret TF_VARS_JSON should contain: {"host":"...","client_certificate":"...","client_key":"...",...}
31+
- name: Load Terraform Variables
32+
run: |
33+
echo '${{ secrets.TF_VARS_JSON }}' | jq -r 'to_entries | .[] | "TF_VAR_\(.key)=\(.value)"' >> $GITHUB_ENV
34+
35+
- name: Gerar token de autenticação do GitHub App
36+
id: generate_token
37+
uses: tibdex/github-app-token@v2
38+
with:
39+
app_id: 882683
40+
private_key: ${{ secrets.PROJECT_APP_PRIVATE_KEY }}
41+
42+
# Configure Git to access private repositories using GitHub App token
43+
- name: Configure Git for Private Repositories
44+
run: |
45+
# Configure Git credential helper for GitHub
46+
git config --global credential.helper store
47+
echo "https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com" > ~/.git-credentials
48+
49+
# Alternative: configure URL rewriting
50+
git config --global url."https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/GersonRS".insteadOf "https://github.com/GersonRS"
51+
52+
echo "✅ Git configured to access private repositories using GitHub App"
53+
54+
# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
55+
- name: Setup Terraform
56+
uses: hashicorp/setup-terraform@v3
57+
58+
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
59+
- name: Terraform Init
60+
run: terraform init -backend-config="access_key=${{ secrets.ACCESS_KEY_ID }}" -backend-config="secret_key=${{ secrets.SECRET_ACCESS_KEY }}" -migrate-state
61+
62+
# Checks that all Terraform configuration files adhere to a canonical format
63+
- name: Terraform Format
64+
run: terraform fmt -check
65+
66+
# Generates an execution plan for Terraform
67+
- name: Terraform Plan
68+
run: terraform plan -input=false
69+
70+
# Deploy da infraestrutura quando uma tag de versão é criada
71+
# Nota: Executa apenas quando tags v* são pushed (ex: v1.0.0, v2.1.3)
72+
- name: Terraform Apply
73+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
74+
run: terraform apply -auto-approve -input=false
Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,48 @@
11
---
2-
# GitHub Actions workflow to automatically push PRs and issues to the Modern Gitops Stack project board.
2+
# GitHub Actions workflow para automaticamente adicionar PRs e issues ao project board do Modern Gitops Stack.
33
#
4-
# IMPORTANT: This workflow is called by other workflows in our Modern Gitops Stack repositories and it is centralized here in
5-
# order to be easily maintained across modules. Because of this, please make sure you're not introducing any breaking
6-
# changes when modifying this workflow.
7-
8-
name: "add-to-project"
9-
4+
# Este workflow gerencia issues e pull requests no projeto Modern Gitops Stack,
5+
# organizando-os no board para melhor acompanhamento e gestão.
6+
7+
name: "modern-gitops-stack-add-to-project"
108
on:
119
workflow_call:
1210
secrets:
13-
PAT:
14-
description: "GitHub token for the Modern Gitops Stack Project"
11+
PROJECT_APP_PRIVATE_KEY:
12+
description: "GitHub App private key para o projeto Modern Gitops Stack"
1513
required: true
1614

17-
permissions:
18-
issues: write
19-
pull-requests: write
20-
contents: write
15+
issues:
16+
types:
17+
- opened
18+
- reopened
19+
20+
pull_request:
21+
types:
22+
- opened
23+
- reopened
2124

2225
jobs:
2326
add-to-project:
2427
runs-on: ubuntu-latest
2528
steps:
26-
- uses: actions/checkout@v5
27-
- name: Add PR or issue to Modern GitOps Stack project board
29+
- name: Checkout repository
30+
uses: actions/checkout@v6
31+
- name: Gerar token de autenticação do GitHub App
32+
id: generate_token
33+
uses: tibdex/github-app-token@v2
34+
with:
35+
app_id: 882683
36+
private_key: ${{ secrets.PROJECT_APP_PRIVATE_KEY }}
37+
38+
- name: Adicionar PR ou issue ao project board do Modern Gitops Stack
39+
id: add-to-project
2840
uses: actions/add-to-project@v1.0.2
2941
with:
3042
project-url: https://github.com/users/GersonRS/projects/2
31-
github-token: ${{ secrets.PAT }}
32-
labeled: bug, needs-triage
33-
label-operator: NOT
34-
- name: Auto Author Assign
43+
github-token: ${{ steps.generate_token.outputs.token }}
44+
45+
- name: Auto-atribuição ao autor
3546
uses: toshimaru/auto-author-assign@v2.1.1
3647
with:
37-
repo-token: ${{ secrets.PAT }}
48+
repo-token: ${{ steps.generate_token.outputs.token }}
Lines changed: 73 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,51 @@
11
---
2-
# GitHub Actions workflow to update the Helm chart dependencies on our modules.
2+
# GitHub Actions workflow para atualizar dependências dos Helm charts da Modern Gitops Stack.
33
#
4-
# IMPORTANT: This workflow is called by other workflows in our Modern Gitops Stack repositories and it is centralized here in
5-
# order to be easily maintained across modules. Because of this, please make sure you're not introducing any breaking
6-
# changes when modifying this workflow.
4+
# Este workflow automatiza a atualização das dependências dos charts utilizados na infraestrutura
5+
# Modern Gitops Stack, criando PRs para facilitar a revisão e deploy das atualizações.
76

87
name: "modules-chart-update"
98

109
on:
1110
workflow_call:
1211
secrets:
13-
PAT:
14-
description: "GitHub token for the Modern Gitops Stack Project"
12+
PROJECT_APP_PRIVATE_KEY:
13+
description: "GitHub token para o projeto Modern Gitops Stack"
1514
required: true
1615
inputs:
1716
update-strategy:
18-
description: "Upgrade strategy to use. Valid values are 'major', 'minor' or 'patch'"
17+
description: "Estratégia de atualização. Valores válidos: 'major', 'minor' ou 'patch'"
1918
type: string
2019
required: true
2120
excluded-dependencies:
22-
description: "Comma-separated list of dependencies to exclude from the update (i.e. 'dependency1,dependency2,dependency3')"
21+
description: "Lista separada por vírgulas de dependências a excluir (ex: 'dependency1,dependency2')"
2322
type: string
2423
required: false
2524
default: ""
2625
dry-run:
27-
description: "Whether to run the update in dry-run mode or not"
26+
description: "Se deve executar em modo dry-run ou não"
2827
type: boolean
2928
required: false
3029
default: false
3130

3231
jobs:
3332
list-charts:
33+
name: "Listar charts Modern Gitops Stack"
3434
runs-on: ubuntu-latest
3535

3636
outputs:
3737
charts: ${{ steps.find-charts.outputs.charts }}
3838

3939
steps:
40-
- name: "Check out the repository"
41-
uses: actions/checkout@v5
40+
- name: "Fazer checkout do repositório Modern Gitops Stack"
41+
uses: actions/checkout@v6
4242

43-
- name: "List charts in the ./charts folder"
43+
- name: "Listar charts na pasta ./charts"
4444
id: find-charts
4545
run: cd charts && echo "charts=$(find . -maxdepth 2 -name 'Chart.yaml' -exec dirname {} \; | sed 's|^\./||' | sort -u | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
4646

4747
chart-update:
48+
name: "Atualizar chart: ${{ matrix.chart-name }}"
4849
runs-on: ubuntu-latest
4950

5051
needs: list-charts
@@ -58,10 +59,10 @@ jobs:
5859
author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
5960

6061
steps:
61-
- name: "Check out the repository"
62-
uses: actions/checkout@v5
62+
- name: "Fazer checkout do repositório Modern Gitops Stack"
63+
uses: actions/checkout@v6
6364

64-
- name: "Upgrade Helm chart dependencies"
65+
- name: "Atualizar dependências do Helm chart"
6566
id: deps-update
6667
uses: camptocamp/helm-dependency-update-action@v0.5.0
6768
with:
@@ -71,16 +72,16 @@ jobs:
7172
update-strategy: "${{ inputs.update-strategy }}"
7273
dry-run: "${{ inputs.dry-run }}"
7374

74-
- name: "Create Pull Request for a minor/patch update"
75+
- name: "Criar Pull Request para atualização minor/patch"
7576
if: ${{ !inputs.dry-run && steps.deps-update.outputs.update-type != 'none' && steps.deps-update.outputs.update-type != 'major' }}
7677
id: minor-pr
77-
uses: peter-evans/create-pull-request@v7
78+
uses: peter-evans/create-pull-request@v8
7879
env:
79-
pr-title: "feat(chart): ${{ steps.deps-update.outputs.update-type }} update of dependencies on ${{ matrix.chart-name }} chart"
80+
pr-title: "feat(chart): atualização ${{ steps.deps-update.outputs.update-type }} de dependências no chart ${{ matrix.chart-name }}"
8081
branch: "chart-autoupdate-${{ steps.deps-update.outputs.update-type }}-${{ matrix.chart-name }}"
8182
labels: "chart-autoupdate-${{ steps.deps-update.outputs.update-type }}"
8283
with:
83-
token: ${{ secrets.PAT }}
84+
token: ${{ secrets.PROJECT_APP_PRIVATE_KEY }}
8485
base: ${{ github.head_ref }}
8586
commit-message: ${{ env.pr-title }}
8687
author: ${{ env.author }}
@@ -93,25 +94,38 @@ jobs:
9394
reviewers: GersonRS
9495
delete-branch: true
9596
body: |
96-
:robot: I have updated the chart *beep* *boop*
97+
🤖 Atualizei o chart automaticamente do Modern Gitops Stack *beep* *boop*
9798
---
9899
99-
## Description of the changes
100+
## 📋 Descrição
100101
101-
This PR updates the dependencies of the **${{ matrix.chart-name }}** Helm chart.
102+
### O que mudou?
103+
Este PR atualiza as dependências do Helm chart **${{ matrix.chart-name }}** do Modern Gitops Stack.
102104
103-
The maximum version bump was a **${{ steps.deps-update.outputs.update-type }}** step.
105+
### Por que foi necessário?
106+
Atualização automática para manter os charts seguros e atualizados.
104107
105-
- name: "Create Pull Request for a major update"
108+
## 🔧 Tipo de Mudança
109+
- [x] 🔧 Configuração/Charts
110+
111+
## 📊 Detalhes da Atualização
112+
- **Chart**: ${{ matrix.chart-name }}
113+
- **Tipo de atualização**: ${{ steps.deps-update.outputs.update-type }}
114+
- **Estratégia**: Atualização automática segura
115+
116+
## ✅ Checklist
117+
- [x] Dependências atualizadas automaticamente
118+
- [x] Seguindo conventional commits
119+
- [x] Labels apropriadas aplicadas
120+
121+
- name: "Criar Pull Request para atualização major"
106122
if: ${{ !inputs.dry-run && steps.deps-update.outputs.update-type != 'none' && steps.deps-update.outputs.update-type == 'major' }}
107123
id: major-pr
108-
uses: peter-evans/create-pull-request@v7
124+
uses: peter-evans/create-pull-request@v8
109125
env:
110-
# This step does not have a branch and labels environment variable, because it is forcefully a major update,
111-
# unlike the previous step, which can either be a patch, minor or major update.
112-
pr-title: "feat(chart)!: major update of dependencies on ${{ matrix.chart-name }} chart"
126+
pr-title: "feat(chart)!: atualização major de dependências no chart ${{ matrix.chart-name }}"
113127
with:
114-
token: ${{ secrets.PAT }}
128+
token: ${{ secrets.PROJECT_APP_PRIVATE_KEY }}
115129
base: ${{ github.head_ref }}
116130
commit-message: ${{ env.pr-title }}
117131
author: ${{ env.author }}
@@ -124,11 +138,37 @@ jobs:
124138
reviewers: GersonRS
125139
delete-branch: true
126140
body: |
127-
:robot: I have updated the chart *beep* *boop*
141+
🤖 Atualizei o chart automaticamente do Modern Gitops Stack *beep* *boop*
128142
---
129143
130-
## Description of the changes
144+
## 📋 Descrição
145+
146+
### O que mudou?
147+
Este PR atualiza as dependências do Helm chart **${{ matrix.chart-name }}** do Modern Gitops Stack.
148+
149+
### Por que foi necessário?
150+
Atualização automática para manter os charts seguros e atualizados.
151+
152+
## 🔧 Tipo de Mudança
153+
- [x] 💥 Breaking change
154+
- [x] 🔧 Configuração/Charts
155+
156+
## ⚠️ Atenção - Atualização Major!
157+
158+
Esta foi uma **atualização major**! Por favor:
159+
1. 📖 Verifique o changelog das dependências atualizadas
160+
2. 🔍 Revise cuidadosamente as breaking changes
161+
3. 🧪 Teste em ambiente de desenvolvimento antes do merge
162+
4. 📚 Atualize a documentação se necessário
131163
132-
This PR updates the dependencies of the **${{ matrix.chart-name }}** Helm chart.
164+
## 📊 Detalhes da Atualização
165+
- **Chart**: ${{ matrix.chart-name }}
166+
- **Tipo**: Major update (pode conter breaking changes)
167+
- **Componentes afetados**: Modern Gitops Stack
133168
134-
:warning: This was a **major** update! Please check the changelog of the updated dependencies and **take notice of any breaking changes before merging**. :warning:
169+
## ✅ Checklist de Revisão
170+
- [ ] Verificar changelog das dependências
171+
- [ ] Revisar breaking changes
172+
- [ ] Testar em ambiente de desenvolvimento
173+
- [ ] Validar impacto no Modern Gitops Stack
174+
- [ ] Atualizar documentação se necessário

0 commit comments

Comments
 (0)