Skip to content

Commit

Permalink
build(ci): introduce initial GitHub actions release flow
Browse files Browse the repository at this point in the history
A simple release workflow that releases using semantic release.
  • Loading branch information
Killusions authored and spike-rabbit committed Dec 23, 2024
1 parent 06e5128 commit a21144b
Show file tree
Hide file tree
Showing 12 changed files with 9,222 additions and 2,876 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
- maintenance/*
- next
pull_request:
jobs:
build-and-test:
Expand All @@ -23,3 +25,29 @@ jobs:
- run: npm run lint:commit
- run: npm run lint
- run: npm run plugin:test

release:
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' || startsWith(github.ref, 'refs/heads/maintenance/')
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
needs: build-and-test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'npm'
- run: npm ci
- run: npm run build
- name: Semantic Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
55 changes: 55 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"branches": [
{
"name": "maintenance/+([0-9])?(.{+([0-9]),x}).x",
"channel": "${name.replace(/^maintenance\\//g, \"\")}"
},
"main",
{
"name": "next",
"channel": "next",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/npm",
{
"pkgRoot": "dist/commitlint-config"
}
],
[
"@semantic-release/npm",
{
"pkgRoot": "dist/eslint-config-angular"
}
],
[
"@semantic-release/npm",
{
"pkgRoot": "dist/eslint-config-typescript"
}
],
[
"@semantic-release/npm",
{
"pkgRoot": "dist/eslint-plugin-defaultvalue"
}
],
[
"@semantic-release/npm",
{
"pkgRoot": "dist/prettier-config"
}
],
[
"@semantic-release/npm",
{
"pkgRoot": "dist/stylelint-config-scss"
}
],
"@semantic-release/github"
]
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This project uses semantic release.

See [GitHub releases](https://github.com/siemens/lint/releases/) for a changelog.
9 changes: 4 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,12 +463,11 @@ deprecation note and appear in the changelog.

## Releasing

To create a new release you need to bump the package version in **package.json**,
update the changelog, commit, tag.
We use [semantic-release](https://semantic-release.gitbook.io/semantic-release) which automates all release tasks.

We use `semantic-release` which automates all these tasks.

TODO: Add details how to use `semantic-release` etc.
- to create a new release push changes to the `main` branch
- to create a pre-release push changes to the `next` branch
- to create a maintenance release push changes to a branch following this pattern: `maintenance/N.N.x` / `maintenance/N.x.x` / `maintenance/N.x` branch where `N` is any existing version

## Attribution

Expand Down
7 changes: 5 additions & 2 deletions commitlint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@siemens/commitlint-config",
"version": "1.2.2",
"version": "0.0.0-development",
"description": "Configuration for commitlint.",
"files": [
"*.js",
"*.md"
],
"repository": {
"type": "git",
"url": "[email protected]:siemens/lint.git"
"url": "git+ssh://git@github.com/siemens/lint.git"
},
"author": {
"name": "Siemens",
Expand All @@ -20,6 +20,9 @@
"siemens",
"lint"
],
"publishConfig": {
"access": "public"
},
"license": "MIT",
"type": "module",
"peerDependencies": {
Expand Down
7 changes: 5 additions & 2 deletions eslint-config-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@siemens/eslint-config-angular",
"version": "1.2.2",
"version": "0.0.0-development",
"description": "Configuration for linting Angular TypeScript and templates using Angular ESLint.",
"files": [
"*.mjs",
Expand All @@ -14,7 +14,7 @@
},
"repository": {
"type": "git",
"url": "[email protected]:siemens/lint.git"
"url": "git+ssh://git@github.com/siemens/lint.git"
},
"author": {
"name": "Siemens",
Expand All @@ -26,6 +26,9 @@
"siemens",
"lint"
],
"publishConfig": {
"access": "public"
},
"license": "MIT",
"peerDependencies": {
"@eslint/js": "^9.9.1",
Expand Down
7 changes: 5 additions & 2 deletions eslint-config-typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@siemens/eslint-config-typescript",
"version": "1.2.2",
"version": "0.0.0-development",
"description": "Configuration for linting TypeScript using typescript-eslint.",
"files": [
"*.mjs",
Expand All @@ -9,7 +9,7 @@
"main": "./index.mjs",
"repository": {
"type": "git",
"url": "[email protected]:siemens/lint.git"
"url": "git+ssh://git@github.com/siemens/lint.git"
},
"author": {
"name": "Siemens",
Expand All @@ -21,6 +21,9 @@
"siemens",
"lint"
],
"publishConfig": {
"access": "public"
},
"license": "MIT",
"peerDependencies": {
"@eslint/js": "^9.9.1",
Expand Down
7 changes: 5 additions & 2 deletions eslint-plugin-defaultvalue/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@siemens/eslint-plugin-defaultvalue",
"version": "1.2.2",
"version": "0.0.0-development",
"main": "lib/index.js",
"type": "module",
"description": "Automatically enrich TSDoc comments with default values or check if they are all correct.",
"repository": {
"type": "git",
"url": "[email protected]:siemens/lint.git"
"url": "git+ssh://git@github.com/siemens/lint.git"
},
"author": {
"name": "Siemens",
Expand All @@ -18,6 +18,9 @@
"siemens",
"lint"
],
"publishConfig": {
"access": "public"
},
"license": "MIT",
"peerDependencies": {
"eslint": "^8.0.0||^9.0.0",
Expand Down
Loading

0 comments on commit a21144b

Please sign in to comment.