File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [main, master, develop]
6+ pull_request :
7+
8+ jobs :
9+ build :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout
13+ uses : actions/checkout@v4
14+
15+ - name : Set up JDK 21
16+ uses : actions/setup-java@v4
17+ with :
18+ distribution : temurin
19+ java-version : " 21"
20+
21+ - name : Setup Gradle
22+ uses : gradle/actions/setup-gradle@v3
23+ with :
24+ cache-read-only : ${{ github.event_name == 'pull_request' }}
25+
26+ - name : Build
27+ run : ./gradlew build
Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ push :
5+ branches : [main, master]
6+ workflow_dispatch :
7+
8+ jobs :
9+ build :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout
13+ uses : actions/checkout@v4
14+
15+ - name : Set up JDK 21
16+ uses : actions/setup-java@v4
17+ with :
18+ distribution : temurin
19+ java-version : " 21"
20+
21+ - name : Setup Gradle
22+ uses : gradle/actions/setup-gradle@v3
23+ with :
24+ cache-read-only : true
25+
26+ - name : Build
27+ run : ./gradlew build
28+
29+ release :
30+ runs-on : ubuntu-latest
31+ needs : build
32+ permissions :
33+ contents : write
34+ issues : write
35+ pull-requests : write
36+ steps :
37+ - name : Checkout
38+ uses : actions/checkout@v4
39+ with :
40+ fetch-depth : 0
41+
42+ - name : Set up JDK 21
43+ uses : actions/setup-java@v4
44+ with :
45+ distribution : temurin
46+ java-version : " 21"
47+
48+ - name : Setup Gradle
49+ uses : gradle/actions/setup-gradle@v3
50+ with :
51+ cache-read-only : true
52+
53+ - name : Set up Node.js
54+ uses : actions/setup-node@v4
55+ with :
56+ node-version : " 20"
57+ cache : pnpm
58+
59+ - name : Set up pnpm
60+ uses : pnpm/action-setup@v4
61+ with :
62+ version : 9.12.3
63+
64+ - name : Install release tooling
65+ run : pnpm install --no-lockfile
66+
67+ - name : Configure Git user
68+ run : |
69+ git config user.name "github-actions[bot]"
70+ git config user.email "github-actions[bot]@users.noreply.github.com"
71+
72+ - name : Run semantic-release
73+ env :
74+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
75+ run : pnpm run release
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ hs_err_pid*
2323.idea /** /dynamic.xml
2424.idea /** /uiDesigner.xml
2525.idea /** /dbnavigator.xml
26+ .idea /
2627.idea /** /gradle.xml
2728.idea /** /libraries
2829cmake-build- * /
@@ -44,4 +45,7 @@ fabric.properties
4445gradle-app.setting
4546! gradle-wrapper.jar
4647.gradletasknamecache
47- run /
48+ run /
49+ node_modules /
50+ pnpm-debug.log
51+ tsconfig.tsbuildinfo
Original file line number Diff line number Diff line change 1+ # Changelog
2+
3+ All notable changes to this project will be documented in this file by semantic-release.
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " voyager-release-tools" ,
3+ "version" : " 0.0.0" ,
4+ "private" : true ,
5+ "description" : " Semantic-release setup for the Voyager build" ,
6+ "license" : " UNLICENSED" ,
7+ "engines" : {
8+ "node" : " >=18"
9+ },
10+ "packageManager" : " pnpm@9.12.3" ,
11+ "scripts" : {
12+ "release" : " pnpm exec ts-node-esm ./scripts/run-semantic-release.mts" ,
13+ "bump-version" : " node ./scripts/bump-version.js"
14+ },
15+ "devDependencies" : {
16+ "@semantic-release/changelog" : " 6.0.3" ,
17+ "@semantic-release/commit-analyzer" : " 11.1.0" ,
18+ "@semantic-release/exec" : " 6.0.3" ,
19+ "@semantic-release/git" : " 10.0.1" ,
20+ "@semantic-release/github" : " 9.0.2" ,
21+ "@semantic-release/release-notes-generator" : " 12.1.0" ,
22+ "semantic-release" : " 23.0.0" ,
23+ "ts-node" : " 10.9.2" ,
24+ "typescript" : " 5.6.3"
25+ }
26+ }
Original file line number Diff line number Diff line change 1+ import type { Options } from "semantic-release" ;
2+
3+ /** Semantic-release configuration using pnpm and Gradle version bumping. */
4+ const config : Options = {
5+ branches : [ "main" , "master" ] ,
6+ tagFormat : "v${version}" ,
7+ plugins : [
8+ "@semantic-release/commit-analyzer" ,
9+ "@semantic-release/release-notes-generator" ,
10+ [
11+ "@semantic-release/changelog" ,
12+ {
13+ changelogFile : "CHANGELOG.md"
14+ }
15+ ] ,
16+ [
17+ "@semantic-release/exec" ,
18+ {
19+ prepareCmd : "pnpm run bump-version ${nextRelease.version}"
20+ }
21+ ] ,
22+ [
23+ "@semantic-release/git" ,
24+ {
25+ assets : [ "CHANGELOG.md" , "build.gradle.kts" ] ,
26+ message : "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}"
27+ }
28+ ] ,
29+ "@semantic-release/github"
30+ ]
31+ } ;
32+
33+ export default config ;
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+
3+ /**
4+ * Replace the Gradle project version in build.gradle.kts with the provided value.
5+ * Used by semantic-release via @semantic-release/exec.
6+ */
7+ const fs = require ( "fs" ) ;
8+ const path = require ( "path" ) ;
9+
10+ const [ , , nextVersion ] = process . argv ;
11+
12+ if ( ! nextVersion ) {
13+ console . error ( "No version supplied to bump-version script." ) ;
14+ process . exit ( 1 ) ;
15+ }
16+
17+ const gradleFile = path . join ( __dirname , ".." , "build.gradle.kts" ) ;
18+ const fileContent = fs . readFileSync ( gradleFile , "utf8" ) ;
19+ const versionPattern = / ( ^ \s * v e r s i o n \s * = \s * " ) [ ^ " ] + ( " ) / m;
20+
21+ if ( ! versionPattern . test ( fileContent ) ) {
22+ console . error ( `Could not find version declaration in ${ gradleFile } ` ) ;
23+ process . exit ( 1 ) ;
24+ }
25+
26+ const updatedContent = fileContent . replace ( versionPattern , `$1${ nextVersion } $2` ) ;
27+ fs . writeFileSync ( gradleFile , updatedContent , "utf8" ) ;
28+ console . log ( `Set project version to ${ nextVersion } ` ) ;
Original file line number Diff line number Diff line change 1+ import semanticRelease from "semantic-release" ;
2+ import config from "../release.config.mts" ;
3+
4+ /**
5+ * Programmatic entrypoint so we can keep the release config in TypeScript (.mts).
6+ */
7+ async function main ( ) {
8+ const result = await semanticRelease ( config ) ;
9+
10+ if ( ! result ) {
11+ console . log ( "No release published." ) ;
12+ return ;
13+ }
14+
15+ const { lastRelease, nextRelease, releases } = result ;
16+ console . log (
17+ `Published ${ nextRelease . type } release version ${ nextRelease . version } ` +
18+ `(previous ${ lastRelease ? lastRelease . version : "none" } )`
19+ ) ;
20+ releases . forEach ( ( release ) => {
21+ console . log ( ` - ${ release . name } @ ${ release . url } ` ) ;
22+ } ) ;
23+ }
24+
25+ main ( ) . catch ( ( error ) => {
26+ console . error ( error ) ;
27+ process . exit ( 1 ) ;
28+ } ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "compilerOptions" : {
3+ "target" : " ES2020" ,
4+ "module" : " NodeNext" ,
5+ "moduleResolution" : " NodeNext" ,
6+ "esModuleInterop" : true ,
7+ "resolveJsonModule" : true ,
8+ "strict" : false ,
9+ "skipLibCheck" : true
10+ },
11+ "include" : [" release.config.mts" , " scripts/**/*.mts" ]
12+ }
You can’t perform that action at this time.
0 commit comments