Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(ci): introduce initial GitHub actions workflow #2

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading