Skip to content

Commit 9a1f7c8

Browse files
SONARJAVA-6140 Add automated release workflow (#5474)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c7af7b3 commit 9a1f7c8

3 files changed

Lines changed: 108 additions & 3 deletions

File tree

.github/workflows/PrepareNextIteration.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
name: Prepare Next Development Iteration
22

33
on:
4+
workflow_call:
5+
inputs:
6+
version:
7+
required: true
8+
type: string
49
workflow_dispatch:
510
inputs:
6-
nextVersion:
7-
description: Version number of the next iteration (e.g. 8.4-SNAPSHOT)
11+
version:
12+
description: The new version (without -SNAPSHOT)
813
required: true
914

1015
jobs:
@@ -17,7 +22,7 @@ jobs:
1722

1823
env:
1924
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20-
NEXT_VERSION: ${{ inputs.nextVersion }}
25+
NEXT_VERSION: "${{ inputs.version }}-SNAPSHOT"
2126

2227
steps:
2328

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Automated Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
short-description:
6+
description: "Short description for the REL ticket"
7+
required: true
8+
type: string
9+
branch:
10+
description: "Branch from which to do the release"
11+
required: true
12+
default: "master"
13+
type: string
14+
new-version:
15+
description: "New version to release (without -SNAPSHOT; if left empty, the current minor version will be auto-incremented)"
16+
required: false
17+
type: string
18+
rule-props-changed:
19+
description: >
20+
"@RuleProperty" changed? See SC-4654
21+
type: boolean
22+
default: false
23+
verbose:
24+
description: "Enable verbose logging"
25+
type: boolean
26+
default: false
27+
dry-run:
28+
description: "Test mode: uses Jira sandbox and creates draft GitHub release"
29+
type: boolean
30+
default: true
31+
ide-integration:
32+
description: "Integrate into IDE"
33+
type: boolean
34+
default: true
35+
sqc-integration:
36+
description: "Integrate into SQC"
37+
type: boolean
38+
default: true
39+
sqs-integration:
40+
description: "Integrate into SQS"
41+
type: boolean
42+
default: true
43+
44+
jobs:
45+
release:
46+
name: Release
47+
uses: SonarSource/release-github-actions/.github/workflows/automated-release.yml@v1
48+
permissions:
49+
statuses: read
50+
id-token: write
51+
contents: write
52+
actions: write
53+
pull-requests: write
54+
with:
55+
project-name: "SonarJava"
56+
plugin-name: "java"
57+
jira-project-key: "SONARJAVA"
58+
runner-environment: "github-ubuntu-latest-s"
59+
rule-props-changed: ${{ github.event.inputs.rule-props-changed }}
60+
short-description: ${{ github.event.inputs.short-description }}
61+
new-version: ${{ github.event.inputs.new-version }}
62+
sqc-integration: ${{ github.event.inputs.sqc-integration == 'true' }}
63+
sqs-integration: ${{ github.event.inputs.sqs-integration == 'true' }}
64+
create-sle-ticket: ${{ github.event.inputs.ide-integration == 'true' }}
65+
create-sli-ticket: ${{ github.event.inputs.ide-integration == 'true' }}
66+
create-slvscode-ticket: ${{ github.event.inputs.ide-integration == 'true' }}
67+
branch: ${{ github.event.inputs.branch }}
68+
pm-email: "jean.jimbo@sonarsource.com"
69+
slack-channel: "squad-jvm-notifs"
70+
verbose: ${{ github.event.inputs.verbose == 'true' }}
71+
use-jira-sandbox: ${{ github.event.inputs.dry-run == 'true' }}
72+
is-draft-release: ${{ github.event.inputs.dry-run == 'true' }}
73+
74+
bump_versions:
75+
name: Bump versions
76+
needs: release
77+
uses: ./.github/workflows/PrepareNextIteration.yml
78+
permissions:
79+
contents: write
80+
pull-requests: write
81+
with:
82+
version: ${{ needs.release.outputs.new-version }}

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ on:
66
release:
77
types:
88
- published
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
type: string
13+
description: Version
14+
required: true
15+
releaseId:
16+
type: string
17+
description: Release ID
18+
required: true
19+
dryRun:
20+
type: boolean
21+
description: Flag to enable the dry-run execution
22+
default: false
923

1024
jobs:
1125
release:
@@ -17,3 +31,7 @@ jobs:
1731
publishToBinaries: true
1832
mavenCentralSync: true
1933
slackChannel: squad-jvm-notifs
34+
# We do not have any inputs if this workflow is triggered by a release event, hence we have to use a fallback for all inputs
35+
version: ${{ inputs.version || github.event.release.tag_name }}
36+
releaseId: ${{ inputs.releaseId || github.event.release.id }}
37+
dryRun: ${{ inputs.dryRun == true }}

0 commit comments

Comments
 (0)