Skip to content

Commit

Permalink
chore(build): Make CI use github app for JD publication
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Apr 22, 2024
1 parent 24e08cf commit c382f34
Showing 1 changed file with 21 additions and 28 deletions.
49 changes: 21 additions & 28 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ concurrency:
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
cancel-in-progress: true

env:
JAVA_VERSION: 11

jobs:
build:
# Only run on PRs if the source branch is on someone else's repo
Expand All @@ -28,28 +25,15 @@ jobs:
os: [ubuntu-20.04, windows-latest]
steps:
# Setup
- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0 # checkout full history for site generation
submodules: recursive
- name: Set up committer info for patching
run: |
git config --global user.email "[email protected]"
git config --global user.name "github-actions"
- name: "Setup JDK ${{ env.JAVA_VERSION }}"
uses: actions/setup-java@v4
- name: setup
id: setup
uses: SpongePowered/.github/.github/actions/setup-java-env@master
with:
distribution: temurin
java-version: "${{ env.JAVA_VERSION }}"
- uses: gradle/wrapper-validation-action@v2

runtime_version: 11
publishing_branch_regex: "master|3\\.x|(?:release/[\\d.x]+)"
# Actually build
- name: Run Gradle Build
uses: gradle/gradle-build-action@v3
with:
cache-read-only: "${{ !(github.ref == 'refs/heads/master' || github.ref == 'refs/heads/3.x' || startsWith(github.ref, 'refs/heads/release/')) || github.event_name == 'pull_request' }}"
arguments: build
run: "./gradlew build"
- name: Archive test results
uses: actions/upload-artifact@v4
if: ${{ always() }}
Expand All @@ -75,7 +59,7 @@ jobs:
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Publish with Gradle
if: "${{ runner.os == 'Linux' && ((env.STATUS == 'release' && github.event_name == 'release') || (env.STATUS != 'release' && github.event_name != 'release' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/3.x' || startsWith(github.ref, 'refs/heads/release/')))) }}"
if: "${{ runner.os == 'Linux' && ((env.STATUS == 'release' && github.event_name == 'release') || (env.STATUS != 'release' && github.event_name != 'release' && (steps.setup.outputs.publishing_branch != ''))) }}"
run: |
mkdir -p build/publish-jd/configurate
./gradlew publish gitPublishCopy copyJavadoc --output build/publish-jd/configurate closeSonatypeStagingRepository
Expand All @@ -94,22 +78,31 @@ jobs:
ORG_GRADLE_PROJECT_spongeKeyStoreAlias: "${{ secrets.CONFIGURATE_JARSIGNING_ALIAS }}"
ORG_GRADLE_PROJECT_spongeKeyStorePassword: "${{ secrets.CONFIGURATE_JARSIGNING_PASSWORD }}"
- name: Publish to GH pages
if: "${{ runner.os == 'Linux' && ((env.STATUS == 'release' && github.event_name == 'release') || (env.STATUS != 'release' && github.event_name != 'release' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/3.x'))) }}"
if: "${{ runner.os == 'Linux' && ((env.STATUS == 'release' && github.event_name == 'release') || (env.STATUS != 'release' && github.event_name != 'release' && (steps.setup.outputs.publishing_branch != ''))) }}"
uses: JamesIves/[email protected]
with:
branch: gh-pages
force: false
folder: build/gitPublish
- name: "Authenticate for JD publication"
if: "${{ runner.os == 'Linux' && ((env.STATUS == 'release' && github.event_name == 'release') || (env.STATUS != 'release' && github.event_name != 'release' && (steps.setup.outputs.publishing_branch != ''))) }}"
uses: "tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a" # v2.1.0
id: jd-token
with:
app_id: "${{ secrets.JAVADOC_PUBLISH_APP_ID }}"
private_key: "${{ secrets.JAVADOC_PUBLISH_APP_KEY }}"
installation_retrieval_mode: "repository"
installation_retrieval_payload: "SpongePowered/APIJavadocs"
- name: Publish Javadoc to Sponge index
if: "${{ runner.os == 'Linux' && ((env.STATUS == 'release' && github.event_name == 'release') || (env.STATUS != 'release' && github.event_name != 'release' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/3.x'))) }}"
if: "${{ runner.os == 'Linux' && ((env.STATUS == 'release' && github.event_name == 'release') || (env.STATUS != 'release' && github.event_name != 'release' && (steps.setup.outputs.publishing_branch != ''))) }}"
uses: JamesIves/[email protected]
with:
folder: build/publish-jd
ssh-key: "${{ secrets.SPONGE_JD_DEPLOY_KEY }}"
repository-name: SpongePowered/APIJavadocs
token: ${{ steps.jd-token.outputs.token }}
branch: data
git-config-name: Spongie
git-config-email: [email protected]
git-config-name: spongie-jd[bot]
git-config-email: "167721471+spongie-jd[bot]@users.noreply.github.com"
clean: false
force: false
commit-message: "Publishing javadoc for ${{ github.repository }} ${{ env.VERSION }}"
Expand Down

0 comments on commit c382f34

Please sign in to comment.