Skip to content

Commit dd40b97

Browse files
committed
feat: use semantic release
1 parent 609d7f9 commit dd40b97

File tree

7 files changed

+1802
-44
lines changed

7 files changed

+1802
-44
lines changed

.github/workflows/test.yml renamed to .github/workflows/build.yml

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test
1+
name: Build
22

33
on:
44
pull_request:
@@ -8,9 +8,21 @@ on:
88
- synchronize
99
branches:
1010
- main
11+
1112
push:
1213
branches:
1314
- main
15+
- next
16+
- maint/**
17+
18+
merge_group:
19+
20+
workflow_dispatch:
21+
inputs:
22+
dryRun:
23+
description: 'Dry-Run'
24+
default: 'true'
25+
required: false
1426

1527
env:
1628
NODE_VERSION: 18
@@ -26,7 +38,6 @@ jobs:
2638
- uses: containerbase/internal-tools/setup@df03af281c3457391eeac44f4f994211cd17fb8b # v3.10.89
2739
with:
2840
save-cache: true
29-
node-version: ${{ env.NODE_VERSION }}
3041

3142
- run: pnpm build
3243

@@ -59,14 +70,14 @@ jobs:
5970
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
6071
with:
6172
token: ${{ secrets.CODECOV_TOKEN }}
62-
73+
6374
- name: Upload test results to Codecov
64-
if: true != cancelled()
75+
if: true != cancelled()
6576
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1
6677
with:
6778
token: ${{ secrets.CODECOV_TOKEN }}
6879

69-
# Catch-all required check for test matrix
80+
# Catch-all required check for test matrix
7081
success:
7182
needs:
7283
- lint
@@ -85,4 +96,43 @@ jobs:
8596
if: |
8697
needs.test.result == 'failure' ||
8798
needs.test.result == 'skipped'
88-
run: exit 1
99+
run: exit 1
100+
101+
release:
102+
needs:
103+
- success
104+
105+
if: github.repository == 'renovatebot/detect-tools' && github.event_name != 'pull_request'
106+
107+
runs-on: ubuntu-24.04
108+
timeout-minutes: 10
109+
110+
permissions:
111+
contents: write
112+
issues: write
113+
id-token: write
114+
115+
steps:
116+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
117+
with:
118+
fetch-depth: 0 # zero stands for full checkout, which is required for semantic-release
119+
filter: blob:none # we don't need all blobs, only the full tree
120+
show-progress: false
121+
122+
- uses: containerbase/internal-tools/setup@1512f33187f6f55360f519853e7b247084e2970f # v3.10.89
123+
with:
124+
checkout: false
125+
126+
- name: Check dry run
127+
run: |
128+
if [[ "${{github.event_name}}" == "workflow_dispatch" && "${{ github.event.inputs.dryRun }}" != "true" ]]; then
129+
echo "DRY_RUN=false" >> "$GITHUB_ENV"
130+
elif [[ "${{env.DO_REALEASE}}" == "true" ]]; then
131+
echo "DRY_RUN=false" >> "$GITHUB_ENV"
132+
fi
133+
134+
- name: semantic-release
135+
run: |
136+
pnpm semantic-release --dry-run ${{env.DRY_RUN}}
137+
env:
138+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yml

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

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.19.0

.npmrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
loglevel=silent
21
save-exact=true
2+
provenance = true
3+
strict-peer-dependencies = true

.releaserc.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"plugins": [
3+
"@semantic-release/commit-analyzer",
4+
"@semantic-release/release-notes-generator",
5+
[
6+
"@semantic-release/github",
7+
{
8+
"releasedLabels": false,
9+
"successComment": false
10+
}
11+
],
12+
"@semantic-release/npm"
13+
],
14+
"analyzeCommits": {
15+
"releaseRules": [
16+
{
17+
"type": "docs",
18+
"scope": "readme.md",
19+
"release": "patch"
20+
},
21+
{
22+
"type": "build",
23+
"release": "patch"
24+
}
25+
]
26+
},
27+
"preset": "conventionalcommits",
28+
"presetConfig": {
29+
"types": [
30+
{
31+
"type": "feat",
32+
"section": "Features"
33+
},
34+
{
35+
"type": "fix",
36+
"section": "Bug Fixes"
37+
},
38+
{
39+
"type": "perf",
40+
"section": "Performance Improvements"
41+
},
42+
{
43+
"type": "revert",
44+
"section": "Reverts"
45+
},
46+
{
47+
"type": "docs",
48+
"section": "Documentation"
49+
},
50+
{
51+
"type": "style",
52+
"section": "Styles"
53+
},
54+
{
55+
"type": "refactor",
56+
"section": "Code Refactoring"
57+
},
58+
{
59+
"type": "test",
60+
"section": "Tests"
61+
},
62+
{
63+
"type": "build",
64+
"section": "Build System"
65+
},
66+
{
67+
"type": "ci",
68+
"section": "Continuous Integration"
69+
},
70+
{
71+
"type": "chore",
72+
"section": "Miscellaneous Chores"
73+
}
74+
]
75+
},
76+
"tagFormat": "${version}",
77+
"branches": [
78+
{
79+
"name": "maint/+([0-9])?(.{+([0-9]),x}).x",
80+
"range": "${name.replace(/^maint\\//g, '')}"
81+
},
82+
"main"
83+
]
84+
}

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "@renovatebot/detect-tools",
3-
"version": "1.1.0",
3+
"version": "0.0.0-semantic-release",
44
"license": "MIT",
55
"type": "commonjs",
66
"main": "dist/index.js",
77
"types": "dist/index.d.ts",
88
"repository": {
99
"type": "git",
10-
"url": "git+https://github.com/renovatebot/detect-tools.git"
10+
"url": "https://github.com/renovatebot/detect-tools.git"
1111
},
1212
"scripts": {
1313
"clean": "rimraf dist",
@@ -28,12 +28,14 @@
2828
"@types/fs-extra": "11.0.4",
2929
"@types/jest": "30.0.0",
3030
"common-tags": "1.8.2",
31+
"conventional-changelog-conventionalcommits": "9.1.0",
3132
"eslint": "9.35.0",
3233
"eslint-formatter-gha": "1.6.0",
3334
"jest": "30.1.3",
3435
"jest-junit": "16.0.0",
3536
"npm-run-all2": "8.0.4",
3637
"rimraf": "6.0.1",
38+
"semantic-release": "24.2.7",
3739
"ts-jest": "29.4.2",
3840
"type-fest": "5.0.0",
3941
"typescript": "5.9.2",

0 commit comments

Comments
 (0)