Skip to content

chore: update cliff config #96

chore: update cliff config

chore: update cliff config #96

name: CI and Release Job
permissions:
contents: write
on:
push:
branches: [ master ]
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v5
with:
java-version: 25
distribution: 'oracle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Run tests
run: |
./gradlew test --no-daemon
- name: Build and generate documentation
if: startsWith(github.ref, 'refs/tags/')
run: |
./gradlew shadowJar javadoc --no-daemon
- name: Upload jar artifact
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: jar
path: build/libs/TeleightBots-*.jar
- name: Upload javadoc artifact
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: javadoc
path: build/docs/javadoc
release:
runs-on: ubuntu-latest
needs: build-and-test
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Download jar artifact
uses: actions/download-artifact@v4
with:
name: jar
path: build/libs
- name: Download javadoc artifact
uses: actions/download-artifact@v4
with:
name: javadoc
path: build/docs/javadoc
- name: Generate a changelog
if: startsWith(github.ref, 'refs/tags/')
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: -vv --latest --strip header
env:
OUTPUT: CHANGES.md
GITHUB_REPO: ${{ github.repository }}
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v3
with:
files: build/libs/TeleightBots-*.jar
draft: true
tag_name: ${{ github.ref_name }}
body_path: CHANGES.md
- name: Deploy javadoc to its assigned branch
if: startsWith(github.ref, 'refs/tags/')
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: javadoc
FOLDER: build/docs/javadoc
CLEAR_GLOBS_FILE: ".github/javadoc-publish-clear"
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
- name: Publish to Maven Central
if: startsWith(github.ref, 'refs/tags/')
env:
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSPHRASE }}
run: |
./gradlew publishMavenPublicationToMavenCentralRepository --no-daemon -PRELEASE_SIGNING_ENABLED=true