Merge pull request #27 from nicholasM95/renovate/junit5-monorepo #50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- develop | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
JAVA_VERSION: '21' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up JDK | |
uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: 'liberica' | |
cache: 'maven' | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4.0.3 | |
with: | |
node-version: 20 | |
- name: Import GPG Key | |
uses: crazy-max/ghaction-import-gpg@v6.1.0 | |
with: | |
gpg_private_key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
- name: Install Semantic Release and plugins | |
run: | | |
npm install semantic-release @semantic-release/exec @semantic-release/changelog @semantic-release/github | |
- name: Calculate next version | |
run: | | |
npx semantic-release --dry-run --no-ci | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SKIP_UPDATE_VERSION_IN_POM: true | |
- name: Build with Maven Wrapper | |
run: ./mvnw install -DskipTests | |
- name: Create Release | |
run: npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Configure maven settings | |
if: github.ref == 'refs/heads/main' | |
uses: s4u/maven-settings-action@v3.0.0 | |
with: | |
servers: | | |
[{ | |
"id": "central", | |
"username": "${{ secrets.OSSRH_USERNAME }}", | |
"password": "${{ secrets.OSSRH_TOKEN }}" | |
}] | |
- name: Publish to the Maven Central Repository | |
if: github.ref == 'refs/heads/main' | |
run: ./mvnw deploy -DskipTests -Dgpg.passphrase=${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
- name: Update CHANGELOG.md | |
if: github.ref == 'refs/heads/main' | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add CHANGELOG.md | |
git commit -m "docs(CHANGELOG): Update CHANGELOG.md" | |
git push origin main | |
- name: Update develop branch | |
if: github.ref == 'refs/heads/main' | |
run: | | |
git fetch origin | |
git checkout develop | |
git merge --ff-only origin/main | |
git push origin develop |