mirror of
https://github.com/AdrianKuta/Tree-Data-Structure.git
synced 2026-06-20 19:30:13 +02:00
ci: cache Gradle, harden permissions, fix test triggers (#45)
- Add gradle/actions/setup-gradle caching to all three workflows - test.yml: trigger on pull_request + push to master (was branches-ignore: master), so PRs from forks are covered and master is verified after merge; add least-privilege permissions and PR-only concurrency - publishRelease.yml: drop unused 'secrets: inherit' and the dead SNAPSHOT env var (Gradle reads the snapshot project property, not a plain env var); add contents: read permissions; fix the misleading Maven Central comment (upload only stages on Central Portal, the final Publish is manual) - docs.yml: add Gradle caching
This commit is contained in:
2
.github/workflows/docs.yml
vendored
2
.github/workflows/docs.yml
vendored
@@ -26,6 +26,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
|
- name: Set up Gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v4
|
||||||
- name: Generate API docs
|
- name: Generate API docs
|
||||||
run: ./gradlew :dokkaGeneratePublicationHtml --console=plain
|
run: ./gradlew :dokkaGeneratePublicationHtml --console=plain
|
||||||
- name: Upload Pages artifact
|
- name: Upload Pages artifact
|
||||||
|
|||||||
10
.github/workflows/publishRelease.yml
vendored
10
.github/workflows/publishRelease.yml
vendored
@@ -5,11 +5,12 @@ on:
|
|||||||
# We'll run this workflow when a new GitHub release is created
|
# We'll run this workflow when a new GitHub release is created
|
||||||
types: [released]
|
types: [released]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
uses: ./.github/workflows/test.yml
|
uses: ./.github/workflows/test.yml
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs: test
|
needs: test
|
||||||
@@ -24,8 +25,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
|
- name: Set up Gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v4
|
||||||
|
|
||||||
# Runs upload, and then closes & releases the repository
|
# Uploads & stages the release on Central Portal. The final "Publish"
|
||||||
|
# step is manual there, because build.gradle.kts sets
|
||||||
|
# publishToMavenCentral(automaticRelease = false).
|
||||||
- name: Publish to MavenCentral
|
- name: Publish to MavenCentral
|
||||||
run: ./gradlew publishToMavenCentral
|
run: ./gradlew publishToMavenCentral
|
||||||
env:
|
env:
|
||||||
@@ -33,4 +38,3 @@ jobs:
|
|||||||
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
|
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
|
||||||
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
|
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
|
||||||
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
|
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
|
||||||
SNAPSHOT: false
|
|
||||||
12
.github/workflows/test.yml
vendored
12
.github/workflows/test.yml
vendored
@@ -2,9 +2,17 @@ name: Test
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches-ignore: [master]
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: ${{ matrix.name }}
|
name: ${{ matrix.name }}
|
||||||
@@ -27,5 +35,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
|
- name: Set up Gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v4
|
||||||
- name: Test
|
- name: Test
|
||||||
run: ./gradlew ${{ matrix.tasks }} --console=plain
|
run: ./gradlew ${{ matrix.tasks }} --console=plain
|
||||||
|
|||||||
Reference in New Issue
Block a user