forked from green-code-initiative/creedengo-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (109 loc) · 4.3 KB
/
release.yml
File metadata and controls
132 lines (109 loc) · 4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Release
on:
workflow_dispatch:
inputs:
strategy:
description: 'Strategy of semantic version to apply'
required: true
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
env:
NODE_VERSION: 20.x
JDK_VERSION: 11
jobs:
release:
name: Create release
runs-on: ubuntu-latest
if: contains('["dedece35","glalloue","jhertout","jules-delecour-dav","olegoaer","zippy1978","utarwyn","mdubois81"]', github.actor)
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_TOKEN }}
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Use JDK ${{ env.JDK_VERSION }}
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ env.JDK_VERSION }}
- name: Apply version to ESLint plugin
run: npm version ${{ inputs.strategy }}
working-directory: eslint-plugin
- name: Get package version
id: package-version
run: echo "version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
working-directory: eslint-plugin
- name: Check tag non-existence
run: if git show-ref --tags --verify --quiet -- "refs/tags/${{ steps.package-version.outputs.version }}"; then echo "::error::Tag already exists" && exit 1; fi
- name: Update Docker Compose configuration
run: sed -i -E 's/plugin-(.*).jar/plugin-${{ steps.package-version.outputs.version }}.jar/' docker-compose.yml
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
with:
prerelease: true
- name: Update changelog
uses: suyaser/keep-a-changelog-new-release@1.4.0
with:
version: ${{ steps.package-version.outputs.version }}
tag: ${{ steps.package-version.outputs.version }}
- name: Apply version to SonarQube plugin
run: mvn versions:set versions:commit -DnewVersion=${{ steps.package-version.outputs.version }}
working-directory: sonar-plugin
- name: Install dependencies
run: yarn install --immutable
working-directory: eslint-plugin
- name: Package SonarQube plugin
run: mvn -e -B package -DskipTests
working-directory: sonar-plugin
- name: Commit new version
uses: EndBug/add-and-commit@v9
with:
message: Release version ${{ steps.package-version.outputs.version }}
default_author: github_actions
- name: Create release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ steps.package-version.outputs.version }}
tag_name: ${{ steps.package-version.outputs.version }}
body: ${{ steps.extract-release-notes.outputs.release_notes }}
token: ${{ secrets.RELEASE_TOKEN }}
files: sonar-plugin/target/ecocode-javascript-plugin-${{ steps.package-version.outputs.version }}.jar
prepare-next-release:
name: Prepare next release
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
token: ${{ secrets.RELEASE_TOKEN }}
- name: Use JDK ${{ env.JDK_VERSION }}
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ env.JDK_VERSION }}
- name: Prepare next snapshot of SonarQube plugin
run: mvn versions:set versions:commit -DnextSnapshot=true
working-directory: sonar-plugin
- name: Get SonarQube plugin version
id: sonar-plugin-version
run: echo ::set-output name=version::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
working-directory: sonar-plugin
- name: Update Docker Compose configuration
run: sed -i -E 's/plugin-(.*).jar/plugin-${{ steps.sonar-plugin-version.outputs.version }}.jar/' docker-compose.yml
- name: Commit new version
uses: EndBug/add-and-commit@v9
with:
message: Prepare for next development iteration
default_author: github_actions