Skip to content

Commit

Permalink
chore(ci): configure semantic release workflow
Browse files Browse the repository at this point in the history
Resolves #11 by implementing a workflow for the release procedure using semantic release to automate
versioning and changelog generation.

- Added `semantic-release` configuration for automating releases.
- Configured `semantic-release-monorepo` for monorepo support.
- Updated GitHub Actions workflow with a release task.
- Ensured the release process skips packages with no changes to prevent unnecessary releases.
  • Loading branch information
jboix committed May 28, 2024
1 parent 2ef6647 commit c9a57d8
Show file tree
Hide file tree
Showing 9 changed files with 11,357 additions and 5,809 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest

permissions:
packages: write
issues: write
contents: write
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 20
always-auth: true
registry-url: https://npm.pkg.github.com/
scope: '@srgssr'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
env :
CI: true
run: |
npm pkg delete scripts.prepare
npm ci
- name: Run build
run: |
npm run build -ws
- name: Release 📦
if: success()
run: npm run release:ci -ws
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16,765 changes: 10,957 additions & 5,808 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
"@commitlint/config-conventional": "^19.1.0",
"@parcel/transformer-sass": "^2.12.0",
"@rollup/plugin-babel": "^6.0.4",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^12.0.0",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^10.0.5",
"@semantic-release/npm": "^12.0.1",
"@semantic-release/release-notes-generator": "^13.0.0",
"@vitest/coverage-v8": "^1.5.0",
"eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0",
Expand All @@ -40,10 +46,11 @@
"eslint-plugin-vitest": "^0.4.1",
"husky": "^9.0.11",
"jsdom": "^24.0.0",
"node-plop": "^0.32.0",
"parcel": "^2.12.0",
"plop": "^4.0.1",
"node-plop": "^0.32.0",
"sass": "^1.75.0",
"semantic-release": "^23.1.1",
"stylelint": "^16.3.1",
"stylelint-config-rational-order": "^0.1.2",
"stylelint-config-standard": "^36.0.0",
Expand Down
111 changes: 111 additions & 0 deletions packages/pillarbox-playlist/.releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"branches": ["main"],
"extends": "semantic-release-monorepo",
"plugins": [
"@semantic-release/commit-analyzer",
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
},
"presetConfig": {
"types": [
{
"type": "breaking",
"section": "Breaking Changes ❗",
"hidden": false
},
{
"type": "feat",
"section": "New Features 🚀",
"hidden": false
},
{
"type": "fix",
"section": "Enhancements and Bug Fixes 🐛",
"hidden": false
},
{
"type": "docs",
"section": "Docs 📖",
"hidden": false
},
{
"type": "style",
"section": "Styles 🎨",
"hidden": false
},
{
"type": "refactor",
"section": "Refactor 🔩",
"hidden": false
},
{
"type": "perf",
"section": "Performances ⚡️",
"hidden": false
},
{
"type": "test",
"section": "Tests ✅",
"hidden": false
},
{
"type": "ci",
"section": "CI 🔁",
"hidden": false
},
{
"type": "chore",
"section": "Chore 🧹",
"hidden": false
}
]
},
"writerOpts": {
"groupBy": "type",
"commitGroupsSort": [
"breaking",
"feat",
"fix"
]
}
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
"@semantic-release/npm",
[
"@semantic-release/git",
{
"assets": [
"package.json",
"package-lock.json",
"CHANGELOG.md"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "dist/**/*"
}
]
}
]
]
}

4 changes: 4 additions & 0 deletions packages/pillarbox-playlist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"type": "git",
"url": "git+https://github.com/SRGSSR/pillarbox-web-suite.git"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"homepage": "https://srgssr.github.io/pillarbox-web-suite/pillarbox-playlist",
"type": "module",
"main": "dist/pillarbox-playlist.cjs",
Expand Down Expand Up @@ -40,6 +43,7 @@
"build:lib": "vite build --config vite.config.lib.js",
"build:ui": "vite build --config vite.config.ui.js",
"github:page": "vite build",
"release:ci": "semantic-release",
"start": " vite --port 4200 --open",
"test": "vitest run --silent --coverage --coverage.reporter text"
},
Expand Down
110 changes: 110 additions & 0 deletions packages/skip-button/.releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"branches": ["main"],
"extends": "semantic-release-monorepo",
"plugins": [
"@semantic-release/commit-analyzer",
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
},
"presetConfig": {
"types": [
{
"type": "breaking",
"section": "Breaking Changes ❗",
"hidden": false
},
{
"type": "feat",
"section": "New Features 🚀",
"hidden": false
},
{
"type": "fix",
"section": "Enhancements and Bug Fixes 🐛",
"hidden": false
},
{
"type": "docs",
"section": "Docs 📖",
"hidden": false
},
{
"type": "style",
"section": "Styles 🎨",
"hidden": false
},
{
"type": "refactor",
"section": "Refactor 🔩",
"hidden": false
},
{
"type": "perf",
"section": "Performances ⚡️",
"hidden": false
},
{
"type": "test",
"section": "Tests ✅",
"hidden": false
},
{
"type": "ci",
"section": "CI 🔁",
"hidden": false
},
{
"type": "chore",
"section": "Chore 🧹",
"hidden": false
}
]
},
"writerOpts": {
"groupBy": "type",
"commitGroupsSort": [
"breaking",
"feat",
"fix"
]
}
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
"@semantic-release/npm",
[
"@semantic-release/git",
{
"assets": [
"package.json",
"package-lock.json",
"CHANGELOG.md"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "dist/**/*"
}
]
}
]
]
}
4 changes: 4 additions & 0 deletions packages/skip-button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"type": "git",
"url": "git+https://github.com/SRGSSR/pillarbox-web-suite.git"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"homepage": "https://srgssr.github.io/pillarbox-web-suite/skip-button",
"type": "module",
"main": "dist/skip-button.cjs",
Expand Down Expand Up @@ -36,6 +39,7 @@
"build:lib": "vite build --config vite.config.lib.js",
"build:ui": "vite build --config vite.config.ui.js",
"github:page": "vite build",
"release:ci": "semantic-release",
"start": " vite --port 4200 --open",
"test": "vitest run --silent --coverage --coverage.reporter text"
},
Expand Down
Loading

0 comments on commit c9a57d8

Please sign in to comment.