From 65ea920ecaef0017c47cf73f92d4ac150c092246 Mon Sep 17 00:00:00 2001 From: Murilo Date: Sat, 26 Oct 2024 10:59:26 -0300 Subject: [PATCH] ci: :wrench: Ajustado workflow de release --- .github/workflows/release.yml | 9 ++++++--- release.config.js | 24 ++++++++++++++++-------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ef3a36e..881f308 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,12 +19,15 @@ jobs: - name: Install dependencies run: npm ci - + + - name: Create or update release branch + run: | + git checkout -B release + - name: Run semantic-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - npx semantic-release --branches main + run: npx semantic-release --branches release - name: Create Pull Request to merge release into main env: diff --git a/release.config.js b/release.config.js index 4b9f1b6..bbba6a4 100644 --- a/release.config.js +++ b/release.config.js @@ -9,7 +9,6 @@ const generatePatchNotes = { date: new Date().toISOString(), }; - // Grava o arquivo JSON na pasta public console.log('Gerando patch notes...'); writeFileSync('public/patch-notes.json', JSON.stringify(patchNotes, null, 2)); console.log('Patch notes gerados com sucesso em public/patch-notes.json'); @@ -17,7 +16,10 @@ const generatePatchNotes = { }; export default { - branches: ['main', 'develop'], + branches: [ + { name: 'main', channel: 'main', type: 'release' }, + { name: 'release', prerelease: false }, + ], plugins: [ '@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', @@ -25,11 +27,17 @@ export default { '@semantic-release/github', generatePatchNotes, '@semantic-release/changelog', - ['@semantic-release/git', { - assets: ['CHANGELOG.md', 'package.json', 'public/patch-notes.json'], - message: 'chore(release): :bookmark: Update changelog and patch notes', - // Aqui vocĂȘ especifica a branch onde deseja que os commits ocorram - branch: 'release' - }], + [ + '@semantic-release/git', + { + assets: [ + 'CHANGELOG.md', + 'package.json', + 'public/patch-notes.json' + ], + message: 'chore(release): :bookmark: Update changelog and patch notes [skip ci]', + branch: 'release', + }, + ], ], };