From 1d3bc03d2cc79fc953b6c25c721fa96548445c64 Mon Sep 17 00:00:00 2001 From: Leonardo Lemos Date: Sun, 24 Mar 2024 20:59:19 -0300 Subject: [PATCH] ci: create the GitHub Actions + Semantic Release --- .github/workflows/release.yaml | 35 ++++++++++++++++++++++++++++++++ release.config.cjs | 37 ++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 .github/workflows/release.yaml create mode 100644 release.config.cjs diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..9bac5b2 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,35 @@ +name: Release +on: + push: + branches: + - main + +permissions: + contents: read + +jobs: + release: + name: Release + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + pull-requests: write + id-token: write + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup Node.js 🚀 + uses: actions/setup-node@v3 + with: + node-version: "lts/*" + - name: Install dependencies 📦 + run: npm i -g pnpm && pnpm install + - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies + run: pnpm audit signatures + - name: Update version and changelog 📚 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npx semantic-release diff --git a/release.config.cjs b/release.config.cjs new file mode 100644 index 0000000..24aa1c7 --- /dev/null +++ b/release.config.cjs @@ -0,0 +1,37 @@ +/** + * @type {import('semantic-release').GlobalConfig} + */ +module.exports = { + branches: ['main'], + repositoryUrl: 'https://github.com/mrlemoos/mrlemoos.dev', + plugins: [ + [ + '@semantic-release/commit-analyzer', + { + preset: 'angular', + parserOpts: { + noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'], + }, + }, + ], + [ + '@semantic-release/release-notes-generator', + { + preset: 'angular', + parserOpts: { + noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'], + }, + writerOpts: { + commitsSort: ['subject', 'scope'], + }, + }, + ], + [ + '@semantic-release/git', + { + message: + 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}', + }, + ], + ], +};