Repository navigation
Wire central catalog refresh #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: Refresh Catalog | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| refresh-catalog: | ||
| name: Refresh central catalog copy | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: '21' | ||
| cache: gradle | ||
|
|
||
| - name: Refresh catalog | ||
| run: ./gradlew --no-daemon refreshCatalog | ||
|
|
||
| - name: Open pull request | ||
| uses: peter-evans/create-pull-request@v7 | ||
| with: | ||
| branch: automation/refresh-central-catalog | ||
| delete-branch: true | ||
| commit-message: Refresh central Gradle version catalog | ||
| title: Refresh central Gradle version catalog | ||
| body: | | ||
| Updates the local Gradle version catalog from NostrGameEngine/libs.catalog. | ||
|
|
||
| If the downloaded catalog is identical to the current file, this workflow exits without opening a pull request. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| name: publish-snapshots | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
| - cron: '07 4 * * 0' | ||
| push: | ||
| pull_request: | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,3 +114,21 @@ nexusPublishing { | |
| } | ||
| } | ||
| } | ||
|
|
||
| tasks.register('refreshCatalog') { | ||
| group = 'build setup' | ||
| description = 'Downloads the central NostrGameEngine Gradle version catalog.' | ||
|
|
||
| def catalogUrl = providers.gradleProperty('centralCatalogUrl') | ||
| .orElse('https://raw.githubusercontent.com/NostrGameEngine/libs.catalog/main/libs.versions.toml') | ||
| def outputFile = layout.projectDirectory.file('gradle/libs.versions.toml') | ||
|
|
||
| outputs.file(outputFile) | ||
|
|
||
| doLast { | ||
| def target = outputFile.asFile | ||
| target.parentFile.mkdirs() | ||
| target.text = new URI(catalogUrl.get()).toURL().getText('UTF-8') | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are two potential issues with the current file download and write implementation:
Using |
||
| println "Refreshed ${target}" | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because
gradle/libs.versions.tomlis committed to the repository, it will always exist. Since this task defines an output file but no inputs, Gradle's up-to-date check will consider the taskUP-TO-DATEand skip execution on subsequent runs, preventing the catalog from actually being refreshed.To ensure the catalog is always refreshed when this task is explicitly executed, configure the task to never be considered up-to-date by adding
outputs.upToDateWhen { false }.