Skip to content

fix: change GITHUB_TOKEN to PUSH_TOKEN #61

fix: change GITHUB_TOKEN to PUSH_TOKEN

fix: change GITHUB_TOKEN to PUSH_TOKEN #61

name: CI and Release Job
permissions:
contents: write
on:
push:
branches: [master]
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
jobs:
build-and-release:
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: 21
distribution: 'oracle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Build and generate documentation
run: |
./gradlew shadowJar javadoc --parallel --no-daemon
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: build/libs/TeleightBots-*.jar
draft: true
tag_name: ${{ github.ref_name }}
generate_release_notes: true
- 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