Skip to content

Merge pull request #278 from finos/main-6.1 #68

Merge pull request #278 from finos/main-6.1

Merge pull request #278 from finos/main-6.1 #68

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-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- 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: [ '11' ]
os: [ 'ubuntu-20.04' ]
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
lfs: true
- 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)
if: matrix.os == 'ubuntu-20.04'
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@v1
with:
java-version: ${{ matrix.java }}
- name: Build with gradle
run: ./gradlew build
build-installer:
name: Build Windows and Linux TimeBase Installer (Java version ${{ 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: [ 'windows-2019' ] # we need windows for building native service libs.
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
lfs: true
- name: Checkout branch (Windows)
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: Setup java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Build with gradle
run: ./gradlew build windowsTimebaseInstaller linuxTimebaseInstaller
- name: Archive Linux installer
uses: actions/upload-artifact@v2
with:
path: java/installer/build/installer/timebase-linux-installer-*.jar
name: timebase-linux-installer
- name: Archive Windows installer
uses: actions/upload-artifact@v2
with:
path: java/installer/build/installer/timebase-windows-installer-*.jar
name: timebase-windows-installer
release:
name: Release
if: ${{ !contains(github.event.head_commit.message, '[skip-ci]') }}
needs: [build, build-installer]
outputs:
tag: ${{ steps.tag.outputs.tag }}
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Release branch
id: tag
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
echo ::set-output name=tag::$versionRelease
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@v2
with:
lfs: true
- 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@v1
with:
java-version: 11
- name: Publish jars
run: >
./gradlew :java:timebase:aerondirect:publish :java:timebase:commons:publish :java:timebase:s3:publish
:java:timebase:pub:publish :java:timebase:api:publish :java:timebase:client:publish :java:timebase:computations-api:publish
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 }}
publish-docker:
name: Publish Dockers
if: ${{ !contains(github.event.head_commit.message, '[skip-ci]') }}
needs: release
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
lfs: true
- 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@v1
with:
java-version: 11
- name: Publish docker
run: ./gradlew :java:timebase:server:dockerPublishImageAll :java:timebase:client:dockerPublishImageAll
env:
DOCKER_REGISTRY_URL: ${{ secrets.DOCKER_REGISTRY_URL }}
DOCKER_REGISTRY_USERNAME: ${{ secrets.DOCKER_HUB_USER }}
DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_HUB_TOKEN }}
publish-github:
needs: release
runs-on: windows-2019
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download linux installer
uses: actions/download-artifact@v2
with:
name: timebase-linux-installer
- name: Download windows installer
uses: actions/download-artifact@v2
with:
name: timebase-windows-installer
- name: Publish github
uses: ncipollo/release-action@v1
with:
artifacts: "timebase-linux-installer-*.jar, timebase-windows-installer-*.jar, LICENSE"
prerelease: true
tag: ${{ needs.release.outputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
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@v2
- 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