Skip to content

[maven-release-plugin] prepare release thirdeye-1.303.0 #671

[maven-release-plugin] prepare release thirdeye-1.303.0

[maven-release-plugin] prepare release thirdeye-1.303.0 #671

name: Publish ThirdEye Backend
on:
push:
branches: [ master ]
paths-ignore:
- kubernetes
- thirdeye-ui/**
# for debugging purpose
workflow_dispatch:
jobs:
publish-thirdeye:
runs-on: ubuntu-latest
environment: github-production
timeout-minutes: 20
steps:
- name: Pull repository
uses: actions/checkout@v4
- name: Install JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Cache - restore local Maven repository
id: cache-restore
uses: actions/cache/restore@v3
with:
path: |
~/.m2/repository
~/.m2/wrapper
key: publish-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: publish-${{ runner.os }}-maven-
- name: Get release version number
id: release-version
run: |
RELEASE_VERSION=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "$GITHUB_OUTPUT"
- name: Set maven repository settings
uses: s4u/[email protected]
with:
servers: >
[
{
"id": "startree-snapshots",
"username": "${{ env.MVN_REPOSITORY_USERNAME }}",
"password": "${{ env.MVN_REPOSITORY_PASSWORD }}"
},
{
"id": "startree-releases",
"username": "${{ env.MVN_REPOSITORY_USERNAME }}",
"password": "${{ env.MVN_REPOSITORY_PASSWORD }}"
}
]
env:
MVN_REPOSITORY_USERNAME: ${{ secrets.MVN_ARTIFACTORY_USERNAME }}
MVN_REPOSITORY_PASSWORD: ${{ secrets.MVN_ARTIFACTORY_TOKEN }}
- name: Publish backend artefacts
run: |
./mvnw -B -Prelease -DskipTests deploy -U
- name: Cache - save local Maven repository
uses: actions/cache/save@v3
# save to cache only if necessary - cache even if failed (useful if some steps are flaky)
if: steps.cache-restore.outputs.cache-hit != 'true' && ( failure() || success())
with:
path: |
~/.m2/repository
~/.m2/wrapper
key: publish-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
# build and publish docker image
- name: Login in Docker registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.DKR_EXTERNAL_REGISTRY }}
username: ${{ secrets.MVN_ARTIFACTORY_USERNAME }}
password: ${{ secrets.MVN_ARTIFACTORY_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
# force using the current state of the folder - TE is already built and available in thirdeye-distribution/target
# see https://github.com/docker/build-push-action#git-context
context: .
push: true
tags: |
${{ env.REGISTRY }}/thirdeye:${{ steps.release-version.outputs.RELEASE_VERSION }}
${{ env.REGISTRY }}/thirdeye:latest
env:
REGISTRY: ${{ secrets.DKR_EXTERNAL_REGISTRY }}
# if a release is cut - notify the enterprise ThirdEye repo
- name: Notify enterprise thirdEye repo
if: steps.release-version.outputs.RELEASE_VERSION != '' && !contains(steps.release-version.outputs.RELEASE_VERSION, 'SNAPSHOT')
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GH_TOKEN }}
repository: startreedata/startree-thirdeye
event-type: community-te-release
client-payload: '{"community_version": "${{ steps.release-version.outputs.RELEASE_VERSION }}"}'
- name: Slack - Notify Success
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "ThirdEye backend publish succeeded. Version: ${{ steps.release-version.outputs.RELEASE_VERSION }}"
SLACK_TITLE: SUCCESS
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Slack - Notify Failure
uses: rtCamp/action-slack-notify@v2
if: failure()
env:
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "@here - ThirdEye backend publish failed."
SLACK_TITLE: FAILURE
SLACK_LINK_NAMES: true
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}