Skip to content

Commit

Permalink
build(releases): add semantic-release and action
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrc committed Mar 5, 2024
1 parent fee6460 commit 9786812
Show file tree
Hide file tree
Showing 6 changed files with 1,846 additions and 876 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Commit lint

on: [push, pull_request]
on: [pull_request]

jobs:
commitlint:
Expand Down
27 changes: 23 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,34 @@ name: Publish
on:
release:
types: [published]
push:
branches: ["add-semantic-release"]
workflow_dispatch:
inputs:
dryRun:
# description: semantic-release params (e.g. --dry-run)
type: choice
default: ""
options:
- --dry-run
- ""

jobs:
build:
name: Build and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x

- name: Install semantic-release extra plugins
run: npm install --save-dev @semantic-release/changelog @semantic-release/git

- name: Install
run: yarn
Expand All @@ -21,6 +39,7 @@ jobs:
run: yarn build

- name: Publish
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.CERN_SIS_NPM }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.CERN_SIS_NPM }}
run: npx semantic-release ${{ inputs.dryRun }}
14 changes: 14 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
import * as rules from "@commitlint/rules";

export default {
extends: ["@commitlint/config-conventional"],
plugins: [
{
rules: {
// Excludes markdown links from body max length calculation
// (needed for semantic-release automatic commits)
"body-max-length": (parsed, _when, _value) => {
parsed.header = parsed.header.replace(/\[([^[\]]+)\]\(([^)]+)\)/, "");
return rules.default["body-max-length"](parsed, _when, _value);
},
},
},
],
};
16 changes: 16 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export default {
branches: ["add-semantic-release"],
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
[
"@semantic-release/git",
{
assets: ["package.json", "CHANGELOG.md"],
message:
"chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
},
],
],
};
9 changes: 6 additions & 3 deletions src/admin/utils/fieldTypes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ const simple = {
mask: {
type: "string",
title: "Input mask",
description:
tooltip:
"Add a mask to visualize and limit the format of the input. Use the following format: `0` (number), `a` (lowercase letter), `A` (uppercase letter), `*` (letter or number). You can escape all these with `\\`. The rest of the characters will be treated as constants",
},
},
Expand All @@ -312,6 +312,7 @@ const simple = {
"ui:placeholder": "BN-000/aa",
"ui:options": {
descriptionIsMarkdown: true,
tooltipIsMarkdown: true,
},
},
},
Expand Down Expand Up @@ -756,7 +757,9 @@ const simple = {
type: "string",
title: "Format",
description:
"Define the date format ([help](https://day.js.org/docs/en/display/format#list-of-all-available-formats)). Remember to include the time in the format if you have selected `date-time` as type",
"Define the date format ([help](https://day.js.org/docs/en/display/format#list-of-all-available-formats))",
tooltip:
"Remember to include the time in the format if you have selected `date-time` as type",
},
minDate: {
type: "string",
Expand All @@ -775,6 +778,7 @@ const simple = {
"ui:placeholder": "DD/MM/YYYY",
"ui:options": {
descriptionIsMarkdown: true,
tooltipIsMarkdown: true,
},
},
minDate: {
Expand Down Expand Up @@ -988,7 +992,6 @@ const advanced = {
},
},
},

};

// HIDDEN FIELDS (not directly selectable by the user):
Expand Down
Loading

0 comments on commit 9786812

Please sign in to comment.