chore: Node.js 16 actions are deprecated. Please update the following… #18
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: | |
push: | |
branches: [release*] | |
env: | |
GRADLE_OPTS: "-Dorg.gradle.daemon=false" | |
jobs: | |
prepare: | |
name: Prepare | |
if: ${{ !contains(github.event.head_commit.message, '[skip-ci]') }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Prepare branch | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git checkout -b workflow-$GITHUB_RUN_ID | |
versionSnapshot=`grep 'version=' gradle.properties | sed 's/version=\([^-]*\)/\1/'` | |
versionRelease=`echo $versionSnapshot | sed 's/\([^-]*\)-SNAPSHOT/\1/'` | |
versionSnapshotNext=`echo $versionSnapshot | perl -pe 's/^((\d+\.)*)(\d+)(.*)$/$1.($3+1).$4/e'` | |
echo "$versionSnapshot -> $versionRelease -> $versionSnapshotNext" | |
sed -i "s/version=$versionSnapshot/version=$versionRelease/" gradle.properties | |
git commit -am "[skip-ci] Generate release version" | |
sed -i "s/version=$versionRelease/version=$versionSnapshotNext/" gradle.properties | |
git commit -am "[skip-ci] Generate next snapshot version" | |
git push origin HEAD | |
build: | |
name: Build Java ${{ matrix.java }} (${{ matrix.os }}) | |
if: ${{ !contains(github.event.head_commit.message, '[skip-ci]') }} | |
needs: prepare | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
java: [ '11' ] | |
os: [ 'ubuntu-20.04'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Checkout branch (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git fetch | |
git checkout -b workflow-$env:GITHUB_RUN_ID origin/workflow-$env:GITHUB_RUN_ID~1 | |
- name: Checkout branch (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git fetch | |
git checkout -b workflow-$GITHUB_RUN_ID origin/workflow-$GITHUB_RUN_ID~1 | |
- name: Setup java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
- name: Build with gradle | |
run: ./gradlew build | |
release: | |
name: Release | |
if: ${{ !contains(github.event.head_commit.message, '[skip-ci]') }} | |
needs: build | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.RELEASE_GITHUB_TOKEN }} | |
- name: Release branch | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git fetch | |
git checkout -b workflow-$GITHUB_RUN_ID origin/workflow-$GITHUB_RUN_ID~1 | |
versionRelease=`grep 'version=' gradle.properties | sed 's/version=\([^-]*\)/\1/'` | |
echo $versionRelease | |
git tag $versionRelease | |
git push origin $versionRelease | |
git push origin origin/workflow-$GITHUB_RUN_ID:$GITHUB_REF | |
publish: | |
name: Publish Maven | |
if: ${{ !contains(github.event.head_commit.message, '[skip-ci]') }} | |
needs: release | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Checkout branch | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git fetch | |
git checkout -b workflow-$GITHUB_RUN_ID origin/workflow-$GITHUB_RUN_ID~1 | |
- name: Setup java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 11 | |
- name: Publish jars | |
run: ./gradlew publishAll | |
env: | |
SONATYPE_REPOSITORY: ${{ secrets.SONATYPE_REPOSITORY }} | |
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }} | |
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
cleanup: | |
name: Cleanup | |
if: ${{ always() && !contains(github.event.head_commit.message, '[skip-ci]') }} | |
needs: publish | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Cleanup | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git push origin --delete workflow-$GITHUB_RUN_ID || true |