Skip to content

Release

Release #11

Workflow file for this run

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@v4
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/[email protected]
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/creedengo-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@v4
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