Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changes to these paths can move secrets, publish artifacts, or change what ships to users,
# so they need an owner's review. Takes effect once branch protection on main requires
# approvals and "require review from Code Owners".
/.github/ @nedtwigg @edgartwigg
/build-logic/ @nedtwigg @edgartwigg
/settings.gradle.kts @nedtwigg @edgartwigg
/build.gradle.kts @nedtwigg @edgartwigg
/gradle.properties @nedtwigg @edgartwigg
59 changes: 0 additions & 59 deletions .github/scripts/configure_publishing_secrets.py

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/changelog-print.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches: [main]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
Expand Down
45 changes: 19 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# least privilege by default; jobs opt in to more below
permissions:
contents: read

jobs:
sanity-check:
name: Sanity Check
Expand All @@ -35,6 +39,9 @@ jobs:
build-gradle:
name: Gradle (Java ${{ matrix.jre }}, ${{ matrix.os }})
needs: sanity-check
permissions:
contents: read
checks: write # mikepenz/action-junit-report posts check runs
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -63,6 +70,9 @@ jobs:
build-maven:
name: Maven (Java ${{ matrix.jre }}, ${{ matrix.os }})
needs: sanity-check
permissions:
contents: read
checks: write # mikepenz/action-junit-report posts check runs
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -91,6 +101,9 @@ jobs:
test-npm:
name: NPM
needs: sanity-check
permissions:
contents: read
checks: write # mikepenz/action-junit-report posts check runs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
Expand All @@ -111,6 +124,9 @@ jobs:
test-shfmt:
name: Shfmt
needs: sanity-check
permissions:
contents: read
checks: write # mikepenz/action-junit-report posts check runs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
Expand Down Expand Up @@ -138,6 +154,9 @@ jobs:
test-idea:
name: IntelliJ IDEA
needs: sanity-check
permissions:
contents: read
checks: write # mikepenz/action-junit-report posts check runs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
Expand Down Expand Up @@ -183,29 +202,3 @@ jobs:
exit 1
fi
echo "All required jobs completed successfully."

publish-snapshots:
name: Publish Snapshots
needs: final-status
if: github.event.repository.fork == false && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-java@v6
with:
distribution: "temurin"
java-version: 21
- uses: gradle/actions/setup-gradle@v6
with:
cache-read-only: true
- name: Configure publishing secrets
env:
NEXUS_PASS64: ${{ secrets.NEXUS_PASS64 }}
GPG_KEY64: ${{ secrets.GPG_KEY64 }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: python3 .github/scripts/configure_publishing_secrets.py
- run: ./gradlew publishToMavenCentral
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.NEXUS_USER }}
32 changes: 20 additions & 12 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# NEXUS_USER
# NEXUS_PASS64 (base64 NOTE: `base64` and `openssl base64` failed, had to use Java
# byte[] data = "{{password}}".getBytes(StandardCharsets.UTF_8);
# String encoded = new String(Base64.getEncoder().encode(data), StandardCharsets.UTF_8);
# System.out.println(encoded);
# NEXUS_PASS
# GPG_PASSPHRASE
# GPG_KEY64 (base64)
# gpg --export-secret-keys --armor KEY_ID | openssl base64 | pbcopy
# GPG_KEY
# gpg --export-secret-subkeys --armor SUBKEY_ID! | pbcopy
# subkeys only, so the primary key never lands in CI
# GRADLE_KEY
# GRADLE_SECRET
#
# NEXUS_PASS and GPG_KEY are environment secrets on `maven-central`, not org secrets.
#
# Store each secret in the exact form the build consumes. GitHub masks the value it was given,
# so anything a workflow step decodes or reshapes is no longer masked and lands in the log.
# That is why the base64 variants (NEXUS_PASS64, GPG_KEY64) were deleted on 2026-09-17; do not
# reintroduce them.

name: deploy
on:
Expand All @@ -28,21 +33,24 @@ jobs:
build:
runs-on: ubuntu-latest
name: deploy
# holds the publishing secrets; its branch policy allows only `release`, which only
# nedtwigg can push to, so nothing else in the repo can reach them
environment: maven-central
permissions:
contents: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.NEXUS_USER }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.NEXUS_PASS }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }}
# signing subkey issued 2026-09-17, replacing 0x4272C851 whose encrypted copy was exposed
# in public CI logs: https://github.com/diffplug/spotless/issues/3089
ORG_GRADLE_PROJECT_signingInMemoryKeyId: "0xFA5C18CFB74EC7C6"
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSPHRASE }}
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Configure publishing secrets
env:
NEXUS_PASS64: ${{ secrets.NEXUS_PASS64 }}
GPG_KEY64: ${{ secrets.GPG_KEY64 }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: python3 .github/scripts/configure_publishing_secrets.py
- name: Configure git credentials for JGit
run: |
git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n x-access-token:${{ secrets.GITHUB_TOKEN }} | base64 -w0)"
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/renovate-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,29 @@ jobs:
ref: ${{ github.head_ref }}
fetch-depth: 0
- uses: actions/setup-python@v7
# branch and PR fields arrive through env, never spliced into the shell: a branch name is
# attacker-controlled text, and ${{ }} would run it as part of the command
- name: Update Changelogs
env:
BASE_REF: ${{ github.base_ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
python3 .github/scripts/update_renovate_changelogs.py \
--base-ref "origin/${{ github.base_ref }}" \
--pr-number "${{ github.event.pull_request.number }}" \
--pr-url "${{ github.event.pull_request.html_url }}"
--base-ref "origin/$BASE_REF" \
--pr-number "$PR_NUMBER" \
--pr-url "$PR_URL"
- name: Commit and push changes
env:
HEAD_REF: ${{ github.head_ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
if [ -n "$(git status --porcelain CHANGES.md plugin-gradle/CHANGES.md plugin-maven/CHANGES.md)" ]; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add CHANGES.md plugin-gradle/CHANGES.md plugin-maven/CHANGES.md
git commit -m "Update changelogs for default formatter version bump (#${{ github.event.pull_request.number }})"
git push origin HEAD:${{ github.head_ref }}
git commit -m "Update changelogs for default formatter version bump (#$PR_NUMBER)"
git push origin "HEAD:$HEAD_REF"
else
echo "No changelog updates needed."
fi
3 changes: 3 additions & 0 deletions .github/workflows/scheduled-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read

jobs:
sanity:
name: Sanity 🦢
Expand Down
19 changes: 3 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,25 +211,12 @@ pluginManagement {

### Gradle - snapshot builds

Snapshot builds are automatically published to Maven Central Snapshots on every commit to `main`. In any project, you can use the following snippet in your `settings.gradle` (for Gradle 6.0+).

```gradle
pluginManagement {
repositories {
maven {
url 'https://central.sonatype.com/repository/maven-snapshots/'
content {
includeGroup 'com.diffplug.spotless'
}
}
gradlePluginPortal()
}
}
```
We don't publish snapshots. Publishing credentials are reachable only from the `release` branch, so
`main` cannot publish anything. Use the local workflow above to test an unreleased change.

### Maven

Run `./gradlew publishToMavenLocal` to publish this to your local repository. You can also use snapshot artifacts from `https://central.sonatype.com/repository/maven-snapshots/`.
Run `./gradlew publishToMavenLocal` to publish this to your local repository.

## License

Expand Down
Loading