Skip to content

Revert version

Revert version #19

Workflow file for this run

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-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Prepare branch
run: |
git config user.name github-actions
git config user.email github-actions@github.com
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: [ '8' ]
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout branch (Windows)
if: matrix.os == 'windows-latest'
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git fetch
git checkout -b workflow-$env:GITHUB_RUN_ID origin/workflow-$env:GITHUB_RUN_ID~1
- name: Checkout branch (Linux/MacOS)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git fetch
git checkout -b workflow-$GITHUB_RUN_ID origin/workflow-$GITHUB_RUN_ID~1
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
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-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Release branch
run: |
git config user.name github-actions
git config user.email github-actions@github.com
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-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout branch
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git fetch
git checkout -b workflow-$GITHUB_RUN_ID origin/workflow-$GITHUB_RUN_ID~1
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 8
- name: Publish jars
run: ./gradlew publishAll
env:
MAVEN_REPOSITORY: ${{ secrets.MAVEN_REPOSITORY }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
cleanup:
name: Cleanup
if: ${{ always() && !contains(github.event.head_commit.message, '[skip-ci]') }}
needs: publish
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Cleanup
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git push origin --delete workflow-$GITHUB_RUN_ID || true