Skip to content

Commit 469257a

Browse files
authored
Merge pull request finos#1552 from Thels/sem-ver-changes
[chore] Sem ver changes
2 parents d3d163a + be2043c commit 469257a

File tree

12 files changed

+294
-69
lines changed

12 files changed

+294
-69
lines changed
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: Automated Release
2+
3+
permissions:
4+
contents: write # needed for semantic-release to create releases and update files
5+
issues: write # needed for semantic-release to comment on issues
6+
pull-requests: write # needed for semantic-release to comment on PRs
7+
id-token: write # needed for npm provenance
8+
9+
on:
10+
push:
11+
branches:
12+
- main
13+
workflow_dispatch: # Allow manual triggering
14+
15+
jobs:
16+
analyze:
17+
runs-on: ubuntu-latest
18+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
19+
outputs:
20+
should-release: ${{ steps.check.outputs.should-release }}
21+
release-type: ${{ steps.check.outputs.release-type }}
22+
next-version: ${{ steps.check.outputs.next-version }}
23+
current-version: ${{ steps.check.outputs.current-version }}
24+
steps:
25+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
26+
with:
27+
fetch-depth: 0
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
31+
with:
32+
node-version: 22
33+
registry-url: 'https://registry.npmjs.org'
34+
35+
- run: npm ci
36+
37+
- name: Check release type
38+
id: check
39+
run: |
40+
npx semantic-release --dry-run --workspace cli > analysis.txt 2>&1 || true
41+
42+
if grep -q "The next release version is" analysis.txt; then
43+
NEXT_VERSION=$(grep "The next release version is" analysis.txt | sed 's/.*The next release version is \([0-9.]*\).*/\1/')
44+
CURRENT_VERSION=$(node -p "require('./cli/package.json').version")
45+
46+
CURRENT_MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
47+
NEXT_MAJOR=$(echo $NEXT_VERSION | cut -d. -f1)
48+
49+
if [ "$NEXT_MAJOR" -gt "$CURRENT_MAJOR" ]; then
50+
RELEASE_TYPE="major"
51+
else
52+
CURRENT_MINOR=$(echo $CURRENT_VERSION | cut -d. -f2)
53+
NEXT_MINOR=$(echo $NEXT_VERSION | cut -d. -f2)
54+
RELEASE_TYPE=$([ "$NEXT_MINOR" -gt "$CURRENT_MINOR" ] && echo "minor" || echo "patch")
55+
fi
56+
57+
echo "should-release=true" >> $GITHUB_OUTPUT
58+
echo "release-type=$RELEASE_TYPE" >> $GITHUB_OUTPUT
59+
echo "next-version=$NEXT_VERSION" >> $GITHUB_OUTPUT
60+
echo "current-version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
61+
62+
echo "🔍 Release: $CURRENT_VERSION → $NEXT_VERSION ($RELEASE_TYPE)"
63+
else
64+
echo "should-release=false" >> $GITHUB_OUTPUT
65+
echo "ℹ️ No release needed"
66+
fi
67+
68+
release-minor-patch:
69+
needs: analyze
70+
runs-on: ubuntu-latest
71+
if: needs.analyze.outputs.should-release == 'true' && needs.analyze.outputs.release-type != 'major'
72+
steps:
73+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
74+
with:
75+
fetch-depth: 0
76+
token: ${{ secrets.GITHUB_TOKEN }}
77+
78+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
79+
with:
80+
node-version: 22
81+
registry-url: 'https://registry.npmjs.org'
82+
83+
- run: npm ci
84+
- run: npm run build
85+
86+
- name: Release
87+
run: npm run semantic-release --workspace cli
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
91+
92+
- name: Summary
93+
run: |
94+
echo "## ✅ Release Published" >> $GITHUB_STEP_SUMMARY
95+
echo "**Version**: ${{ needs.analyze.outputs.current-version }} → ${{ needs.analyze.outputs.next-version }}" >> $GITHUB_STEP_SUMMARY
96+
echo "**Type**: ${{ needs.analyze.outputs.release-type }}" >> $GITHUB_STEP_SUMMARY
97+
98+
prepare-major-release:
99+
needs: analyze
100+
runs-on: ubuntu-latest
101+
if: needs.analyze.outputs.should-release == 'true' && needs.analyze.outputs.release-type == 'major'
102+
steps:
103+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
104+
with:
105+
fetch-depth: 0
106+
token: ${{ secrets.GITHUB_TOKEN }}
107+
108+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
109+
with:
110+
node-version: 22
111+
112+
- run: npm ci
113+
114+
- name: Create draft release
115+
env:
116+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117+
run: |
118+
# Generate release notes
119+
npx semantic-release --dry-run --workspace cli > release-output.txt 2>&1 || true
120+
121+
cat > release-notes.md << EOF
122+
## 🚨 Major Version Release
123+
124+
This major release contains breaking changes and requires manual approval.
125+
126+
### 💥 Breaking Changes
127+
$(grep -i "BREAKING CHANGE" release-output.txt | head -5 || echo "Please review the changes below for breaking changes.")
128+
129+
### 📋 Changes
130+
$(git log --oneline \$(git describe --tags --abbrev=0 2>/dev/null || echo "HEAD~10")..HEAD --grep="feat\|fix" -- cli/ | head -10)
131+
132+
### ⚠️ Before Publishing
133+
- [ ] Review breaking changes
134+
- [ ] Update documentation
135+
- [ ] Notify users
136+
137+
**Publishing will immediately deploy to NPM.**
138+
EOF
139+
140+
# Create draft release
141+
gh release create "${{ needs.analyze.outputs.next-version }}" \
142+
--title "v${{ needs.analyze.outputs.next-version }}" \
143+
--notes-file release-notes.md \
144+
--draft \
145+
--target "${{ github.sha }}"
146+
147+
- run: |
148+
echo "## 🚨 Major Release Draft Created" >> $GITHUB_STEP_SUMMARY
149+
echo "**Version**: ${{ needs.analyze.outputs.current-version }} → ${{ needs.analyze.outputs.next-version }}" >> $GITHUB_STEP_SUMMARY
150+
echo "**Action Required**: Review and publish the draft release" >> $GITHUB_STEP_SUMMARY

.github/workflows/cve-scanning-node.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
with:
3737
node-version: 22
3838
- name: Build project with NPM
39-
run: npm install --omit=dev
39+
run: npm install --omit=dev --ignore-scripts
4040
working-directory: ${{ matrix.module-folder }}
4141
- name: Depcheck
4242
uses: dependency-check/Dependency-Check_Action@main

.github/workflows/license-scanning-node.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
2626
with:
2727
node-version: ${{ matrix.node-version }}
28-
- run: npm install --omit=dev
28+
- run: npm install --omit=dev --ignore-scripts
2929
working-directory: ${{ matrix.module-folder }}
3030
- run: npm install -g node-license-validator
3131
working-directory: ${{ matrix.module-folder }}

.github/workflows/publish-cli-to-npm.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
name: Publish CLI to NPM
1+
name: Publish CLI to NPM (Legacy - Manual Release)
2+
3+
# This workflow is now LEGACY - automated releases happen via automated-release.yml
4+
# Only keep this for emergency manual releases if needed
25

36
permissions:
4-
contents: write # needed for semantic-release to create releases and update files
5-
issues: write # needed for semantic-release to comment on issues
6-
pull-requests: write # needed for semantic-release to comment on PRs
7+
contents: write
8+
issues: write
9+
pull-requests: write
710

811
on:
9-
release:
10-
types: [published]
12+
workflow_dispatch: # Manual trigger only
13+
inputs:
14+
force_publish:
15+
description: 'Force publish even if automated release exists'
16+
required: false
17+
default: false
18+
type: boolean
1119

1220
jobs:
1321
publish-cli:
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Publish Major Release
2+
3+
permissions:
4+
contents: write
5+
id-token: write
6+
7+
on:
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
if: startsWith(github.event.release.tag_name, 'v') && !github.event.release.prerelease
15+
steps:
16+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
17+
with:
18+
ref: ${{ github.event.release.tag_name }}
19+
fetch-depth: 0
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
23+
with:
24+
node-version: 22
25+
registry-url: 'https://registry.npmjs.org'
26+
27+
- run: npm ci
28+
- run: npm run build
29+
30+
- name: Update version and publish
31+
run: |
32+
VERSION=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//')
33+
echo "Publishing version: $VERSION"
34+
35+
cd cli
36+
npm version $VERSION --no-git-tag-version
37+
38+
# Update changelog
39+
if [ ! -f CHANGELOG.md ]; then
40+
echo "# Changelog" > CHANGELOG.md
41+
echo "" >> CHANGELOG.md
42+
fi
43+
44+
echo "## [$VERSION] - $(date +%Y-%m-%d)" > temp_changelog.md
45+
echo "" >> temp_changelog.md
46+
echo "${{ github.event.release.body }}" >> temp_changelog.md
47+
echo "" >> temp_changelog.md
48+
cat CHANGELOG.md >> temp_changelog.md
49+
mv temp_changelog.md CHANGELOG.md
50+
51+
- name: Commit and publish
52+
run: |
53+
git config --local user.email "action@github.com"
54+
git config --local user.name "GitHub Action"
55+
git add cli/package.json cli/CHANGELOG.md
56+
git commit -m "chore(cli): release ${{ github.event.release.tag_name }} [skip ci]" || true
57+
git push origin HEAD:main
58+
59+
cd cli
60+
npm publish
61+
env:
62+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/validate-commit-messages.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no-install commitlint --edit "$1"

calm-hub/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
<artifactId>frontend-maven-plugin</artifactId>
161161
<version>1.15.1</version>
162162
<configuration>
163-
<workingDirectory>${project.basedir}/../calm-hub-ui</workingDirectory>
163+
<workingDirectory>${project.basedir}/..</workingDirectory>
164164
<installDirectory>target</installDirectory>
165165
</configuration>
166166
<executions>
@@ -189,7 +189,7 @@
189189
<goal>npm</goal>
190190
</goals>
191191
<configuration>
192-
<arguments>run prod</arguments>
192+
<arguments>run calm-hub-ui:prod</arguments>
193193
</configuration>
194194
</execution>
195195
</executions>

cli/.releaserc.json

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"main"
44
],
55
"repositoryUrl": "https://github.com/finos/architecture-as-code",
6-
"tagFormat": "cli-v${version}",
6+
"tagFormat": "${version}",
7+
"ci": true,
8+
"dryRun": false,
79
"plugins": [
810
[
911
"@semantic-release/commit-analyzer",
@@ -20,8 +22,40 @@
2022
{ "type": "test", "scope": "cli", "release": false },
2123
{ "type": "style", "scope": "cli", "release": false },
2224
{ "type": "ci", "scope": "cli", "release": false },
23-
{ "scope": "!cli", "release": false }
24-
]
25+
{ "type": "feat", "scope": "shared", "release": "minor" },
26+
{ "type": "fix", "scope": "shared", "release": "patch" },
27+
{ "type": "perf", "scope": "shared", "release": "patch" },
28+
{ "type": "revert", "scope": "shared", "release": "patch" },
29+
{ "type": "docs", "scope": "shared", "release": "patch" },
30+
{ "type": "chore", "scope": "shared", "release": false },
31+
{ "type": "refactor", "scope": "shared", "release": "patch" },
32+
{ "type": "test", "scope": "shared", "release": false },
33+
{ "type": "style", "scope": "shared", "release": false },
34+
{ "type": "ci", "scope": "shared", "release": false },
35+
{ "type": "feat", "scope": "calm-models", "release": "minor" },
36+
{ "type": "fix", "scope": "calm-models", "release": "patch" },
37+
{ "type": "perf", "scope": "calm-models", "release": "patch" },
38+
{ "type": "revert", "scope": "calm-models", "release": "patch" },
39+
{ "type": "docs", "scope": "calm-models", "release": "patch" },
40+
{ "type": "chore", "scope": "calm-models", "release": false },
41+
{ "type": "refactor", "scope": "calm-models", "release": "patch" },
42+
{ "type": "test", "scope": "calm-models", "release": false },
43+
{ "type": "style", "scope": "calm-models", "release": false },
44+
{ "type": "ci", "scope": "calm-models", "release": false },
45+
{ "scope": "!(cli|shared|calm-models)", "release": false },
46+
{ "type": "feat", "release": "minor" },
47+
{ "type": "fix", "release": "patch" },
48+
{ "type": "perf", "release": "patch" },
49+
{ "type": "revert", "release": "patch" }
50+
],
51+
"parserOpts": {
52+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
53+
},
54+
"transform": {
55+
"cli/**": { "scope": "cli" },
56+
"shared/**": { "scope": "shared" },
57+
"calm-models/**": { "scope": "calm-models" }
58+
}
2559
}
2660
],
2761
[

commitlint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919
'release'
2020
]
2121
],
22-
'subject-case': [2, 'always', 'lower-case'],
22+
'subject-case': [0],
2323
'subject-empty': [2, 'never'],
2424
'subject-full-stop': [2, 'never', '.'],
2525
'type-case': [2, 'always', 'lower-case'],

0 commit comments

Comments
 (0)