Skip to content

chore: Send google chat notification for a release (#68) #437

chore: Send google chat notification for a release (#68)

chore: Send google chat notification for a release (#68) #437

Workflow file for this run

name: Continuous Integration
on:
pull_request:
push:
tags:
- '*'
branches:
- 'main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build-and-test:
name: Build and Run Tests
strategy:
matrix:
java-version: [ 17 ]
runs-on: ubuntu-latest
steps:
- name: Checkout current branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java-version }}
cache: sbt
- name: Build and Test
run: sbt -v coverage test headerCheckAll fmtCheck coverageAggregate
- name: Unit Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Unit Test Results
path: ./target/test-reports/TEST-*.xml
reporter: java-junit
- name: Upload coverage data to codacy
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ./target/scala-3.3.0/coverage-report/cobertura.xml
test-docs-build:
name: Test docs
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Install requirements (pip, npm, apt)
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Build docs
run: mkdocs build
publish-docker-image:
if: (github.ref == 'refs/heads/main' && github.event_name != 'release') || startsWith(github.ref, 'refs/tags/')
needs: build-and-test
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.docker_image_tag.outputs.tag }}
strategy:
matrix:
java-version: [ 17 ]
steps:
- name: Checkout current branch
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java-version }}
cache: sbt
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push image
run: export DOCKER_BUILDKIT=1; sbt Docker/publish
- name: Output docker image tag
id: docker_image_tag
run: echo "tag=$(git describe --tag --dirty --abbrev=7 --always | tr -d '\n')" >> "$GITHUB_OUTPUT"
shell: bash # Explicit for fail-fast behaviour
trigger-dev-deployment:
name: Trigger deployment to DEV
runs-on: ubuntu-latest
needs: publish-docker-image
steps:
- name: Trigger deployment to DEV
env:
IMAGE_TAG: ${{needs.publish-docker-image.outputs.tag}}
JENKINS_BASIC_AUTH_USER: ${{secrets.JENKINS_BASIC_AUTH_USER}}
JENKINS_BASIC_AUTH_PASS: ${{secrets.JENKINS_BASIC_AUTH_PASS}}
JENKINS_DEV_WEBHOOK: ${{secrets.JENKINS_DEV_WEBHOOK}}
run: |
echo "Trigger deployment for tag=$IMAGE_TAG"; \
curl -f -u "${JENKINS_BASIC_AUTH_USER}:${JENKINS_BASIC_AUTH_PASS}" \
-X POST "${JENKINS_DEV_WEBHOOK}" \
-d "Service=ingest&Version=${IMAGE_TAG}"
send-chat-notification:
name: Send google chat notification
needs: [publish-docker-image]
runs-on: ubuntu-latest
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
steps:
- name: Send notification to google chat room "DSP releases"
uses: lakto/google-chat-action@main
with:
url: ${{ secrets.GOOGLE_CHAT_DSP_RELEASES_WEBHOOK_URL }}