Skip to content

github actions: add slack notification #18

github actions: add slack notification

github actions: add slack notification #18

Workflow file for this run

name: Default
on:
push:
branches:
- '**'
release:
types: [ published ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Download Cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-cache-
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Echo Version
run: |
./gradlew cV | grep "Project version" | cut -d ":" -f2
# if currently building a branch we do not want to publish as release, it's going to be a snapshot version anyway
# -> simplify the process by just always publishing to sonatype
- name: Publish to Sonatype
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
notify-slack:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Notify Slack
uses: iRoachie/slack-github-actions@v2.3.2
env:
SLACK_WEBHOOK_URL: ${{ vars.LP_SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}