chore: refactor tests #58
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@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Set up JDK | |
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: 'liberica' | |
cache: 'maven' | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4.0.4 | |
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 |