Skip to content

Commit

Permalink
ci: 🔧 Ajustado workflow de release
Browse files Browse the repository at this point in the history
  • Loading branch information
LiloMarino committed Oct 26, 2024
1 parent 4f798f5 commit cbe7aa9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,18 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

with:
ssh-key: ${{ secrets.DEPLOY_KEY }} # Usando a chave SSH de deploy

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx semantic-release --branches main

- name: Create Pull Request to merge release into main
- name: Run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{"title":"Release Update","body":"Merging release branch into main.","head":"release","base":"main"}' \
https://api.github.com/repos/${{ github.repository }}/pulls
run: npx semantic-release
14 changes: 8 additions & 6 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,29 @@ 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');
},
};

export default {
branches: ['main', 'develop'],
branches: ['main'],
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
['@semantic-release/npm', { npmPublish: false }],
'@semantic-release/github',
generatePatchNotes,
'@semantic-release/changelog',
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
['@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'
message: 'chore(release): :bookmark: Update changelog and patch notes [skip ci]',
}],
],
};

0 comments on commit cbe7aa9

Please sign in to comment.