Remove push channel from Message Center #163
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: Build Engagements Data | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
- 'support/**' | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
main: | |
if: "!contains(github.event.head_commit.message, '[skip bump]') && !contains(github.event.head_commit.message, 'nobump/')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of sonar analysis | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Cache Maven packages | |
uses: actions/cache@v1 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Get version from POM | |
run: | | |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
VERSION_PARTS=($(echo $VERSION | tr "." "\n")) | |
echo "MAJOR=${VERSION_PARTS[0]}" >> $GITHUB_ENV | |
echo "MINOR=${VERSION_PARTS[1]}" >> $GITHUB_ENV | |
echo "PATCH=${VERSION_PARTS[2]}" >> $GITHUB_ENV | |
echo "DOCKER_TAG_VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Setup release version | |
if: contains(github.ref, 'master') | |
run: | | |
NEW_VERSION="$((MAJOR)).$((MINOR+1)).0" | |
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV | |
- name: Setup release version from a snapshot | |
if: "contains(github.ref, 'master') && contains(env.PATCH, 'SNAPSHOT')" | |
run: | | |
NEW_VERSION="${MAJOR}.${MINOR}.$(echo $PATCH | awk 'BEGIN { FS = "-" } ; { print $1 }')" | |
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV | |
- name: Setup patch version | |
if: "(contains(github.ref, 'master') || contains(github.ref, 'support/')) && contains(github.event.head_commit.message, 'hotfix/')" | |
run: | | |
NEW_VERSION="$((MAJOR)).$((MINOR)).$((PATCH+1))" | |
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV | |
- name: Setup PR version | |
if: contains(github.ref, '/pull/') | |
run: | | |
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}-PR-$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')" | |
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV | |
- name: Setup docker tag version | |
if: "env.NEW_VERSION != null" | |
run: | | |
echo "DOCKER_TAG_VERSION=${NEW_VERSION}" >> $GITHUB_ENV | |
- name: Setup snapshot docker tag with execution number | |
if: "env.NEW_VERSION == null && contains(env.PATCH, 'SNAPSHOT')" | |
run: | | |
DOCKER_TAG_VERSION="${MAJOR}.${MINOR}.$(echo $PATCH | awk 'BEGIN { FS = "-" } ; { print $1 }')-rc${GITHUB_RUN_NUMBER}" | |
echo "DOCKER_TAG_VERSION=${DOCKER_TAG_VERSION}" >> $GITHUB_ENV | |
- name: Update POM Version | |
if: env.NEW_VERSION != null | |
run: | | |
echo "New version is: $NEW_VERSION" | |
mvn versions:set versions:update-child-modules -DnewVersion=${NEW_VERSION} -DprocessAllModules -DgenerateBackupPoms=false | |
- name: Generate Engagements data collections | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
uses: ./.github/actions/build-and-test | |
with: | |
githubProject: ${{ github.event.repository.name }} | |
## | |
# | |
# Use maven-docker-plugin to build and push docker image to ECR | |
# | |
## | |
- name: Build Engagements Data docker image | |
shell: bash | |
run: | | |
echo "ECR Docker build retail with tag ${NEW_VERSION}" | |
mvn clean package -Pbuild-retail -B docker:tag -Ddocker.image.tag=${NEW_VERSION} -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn | |
echo "ECR Docker build business with tag ${NEW_VERSION}" | |
mvn clean package -Pbuild-business -B docker:tag -Ddocker.image.tag=${NEW_VERSION} -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn | |
echo "ECR Docker build oneruntime with tag ${NEW_VERSION}" | |
mvn clean package -Pbuild-oneruntime -B docker:tag -Ddocker.image.tag=${NEW_VERSION} -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn | |
## | |
# | |
# Use maven-docker-plugin to build and push docker image to ECR | |
# | |
## | |
# - name: Push Engagements Data docker image | |
# shell: bash | |
# run: | | |
# echo "ECR Docker push retail with tag ${NEW_VERSION}" | |
# mvn clean package -Ppush-retail -Ddocker.skip.extendedAuth=true -Ddocker.push.username=${{ steps.ecr-credentials.outputs.username }} -Ddocker.push.password=${{ steps.ecr-credentials.outputs.password }} -B docker:tag -Ddocker.image.tag=${NEW_VERSION} -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn | |
# | |
# echo "ECR Docker push business with tag ${NEW_VERSION}" | |
# mvn clean package -Ppush-business -Ddocker.skip.extendedAuth=true -Ddocker.push.username=${{ steps.ecr-credentials.outputs.username }} -Ddocker.push.password=${{ steps.ecr-credentials.outputs.password }} -B docker:tag -Ddocker.image.tag=${NEW_VERSION} -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn | |
# | |
# echo "ECR Docker push oneruntime with tag ${NEW_VERSION}" | |
# mvn clean package -Ppush-oneruntime -Ddocker.skip.extendedAuth=true -Ddocker.push.username=${{ steps.ecr-credentials.outputs.username }} -Ddocker.push.password=${{ steps.ecr-credentials.outputs.password }} -B docker:tag -Ddocker.image.tag=${NEW_VERSION} -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn | |
- name: Commit files | |
if: "contains(github.ref, 'master') || contains(github.ref, 'support/')" | |
run: | | |
echo "Adding github tag ${NEW_VERSION}" | |
git config --local user.email "engagements-data_releaser@backbase.com" | |
git config --local user.name "bb-engagements-data-bot" | |
git commit -m "[skip bump] version bump" -a | |
git tag -a $NEW_VERSION -m "[version bump]" | |
- name: Push changes | |
if: "contains(github.ref, 'master') || contains(github.ref, 'support/')" | |
uses: ad-m/github-push-action@master | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |