Skip to content

Commit b785ee7

Browse files
gustavomarques00Gustavo
andauthored
fix(release): corrigir token npm e separar workflows de release e PR (#15)
* chore(release): 1.0.4 * fix(release-publish): corrige push usando token no workflow para evitar erro 403 * ci(release): automatiza versionamento, changelog e publicação no npm via GitHub Actions - workflow atualizado para: - executar standard-version no CI - push automático de commits e tags gerados - publicar pacote no npm automaticamente após release - uso de token de acesso pessoal do GitHub para push seguro - uso de token npm via secrets para publicação segura Facilita releases automáticas e reduz passos manuais. * fix(ci): corrige push no workflow de release usando token correto para evitar erro 403 * fix(release): corrigir push no workflow com token npm * ci: add release create PR and publish workflows - Adiciona workflow para criar branch de release e abrir PR automático - Adiciona workflow para publicar pacote no npm após merge na main - Mantém CI de testes e cobertura separados * refactor: separar workflows em ci, release-create-pr e release-publish para automação correta - Criado workflow para testes e cobertura (ci.yml) - Criado workflow para criação automática de branch e PR de release (release-create-pr.yml) - Criado workflow para publicar pacote npm após merge na main (release-publish.yml) * fix(ci): desabilitar verificação GPG no upload para Codecov - Adiciona variável de ambiente CODECOV_GPG_VERIFY=false para evitar erro de assinatura GPG - Corrige falha na action do Codecov ao validar a assinatura do binário --------- Co-authored-by: Gustavo <gustavomarquesm@gmail.com>
1 parent 0783a8a commit b785ee7

3 files changed

Lines changed: 63 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ jobs:
3333
with:
3434
token: ${{ secrets.CODECOV_TOKE }}
3535
fail_ci_if_error: true
36-
verbose: true
36+
verbose: true
37+
env:
38+
CODECOV_GPG_VERIFY: false
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Create Release Pull Request
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
create_release_pr:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 18
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Run standard-version (bump version and changelog)
27+
run: npx standard-version
28+
29+
- name: Get new version tag
30+
id: get_version
31+
run: echo "tag=$(node -p \"require('./package.json').version\")" >> $GITHUB_OUTPUT
32+
33+
- name: Configure git
34+
run: |
35+
git config user.name "github-actions[bot]"
36+
git config user.email "github-actions[bot]@users.noreply.github.com"
37+
38+
- name: Create release branch and push
39+
env:
40+
GITHUB_PAT: ${{ secrets.TOKEN_GITHUB }}
41+
RELEASE_BRANCH: release/v${{ steps.get_version.outputs.tag }}
42+
run: |
43+
git checkout -b $RELEASE_BRANCH
44+
git push origin $RELEASE_BRANCH
45+
46+
- name: Create Pull Request
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
49+
run: |
50+
sudo apt-get update
51+
sudo apt-get install -y gh
52+
echo "${GITHUB_TOKEN}" | gh auth login --with-token
53+
gh pr create --title "Release v${{ steps.get_version.outputs.tag }}" \
54+
--body "Release automática da versão v${{ steps.get_version.outputs.tag }}" \
55+
--base main --head $RELEASE_BRANCH \
56+
--reviewer gustavomarques00 \
57+
--assignee gustavomarques00

.github/workflows/release-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ name: Release and Publish
33
on:
44
push:
55
branches:
6-
- main # Executa apenas quando push for para a main
6+
- main
77

88
jobs:
99
release:
10-
name: Version bump, changelog, release & publish
10+
name: Publish package to npm
1111
runs-on: ubuntu-latest
1212

1313
steps:
1414
- name: Checkout code
1515
uses: actions/checkout@v4
1616
with:
17-
fetch-depth: 0 # Necessário para tags e histórico completo
17+
fetch-depth: 0
1818

1919
- name: Setup Node.js
2020
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)