Skip to content

Commit a6b7a7d

Browse files
authored
Publish SNAPSHOT on jablib change (#13774)
1 parent 8699628 commit a6b7a7d

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

.github/workflows/publish.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ name: Publish to maven central
22

33
on:
44
pull_request:
5-
paths:
6-
- .github/workflows/publish.yml
75
push:
86
paths:
9-
- .github/workflows/publish.yml
7+
- '**'
108
tags:
11-
- '*'
9+
- '**'
1210
schedule:
13-
# run on each Monday
11+
# Run on each Monday
12+
# Additional run in addition to the other events, because some resources could have changes
1413
- cron: '2 3 * * 1'
1514
workflow_dispatch:
1615
inputs:
@@ -34,9 +33,32 @@ concurrency:
3433
cancel-in-progress: true
3534

3635
jobs:
36+
detect_changes:
37+
runs-on: ubuntu-latest
38+
outputs:
39+
changed: ${{ steps.changed.outputs.any_changed }}
40+
steps:
41+
- uses: actions/checkout@v5
42+
with:
43+
fetch-depth: 0
44+
- name: Detect changed jablib classes or workflow
45+
id: changed
46+
uses: tj-actions/changed-files@v45
47+
with:
48+
files: |
49+
jablib/src/main/java/**/*.java
50+
.github/workflows/publish.yml
51+
3752
publish:
3853
name: jablib
39-
if: github.repository == 'JabRef/jabref'
54+
needs: detect_changes
55+
if: >
56+
github.event_name == 'schedule' ||
57+
github.event_name == 'workflow_dispatch' ||
58+
(needs.detect_changes.outputs.changed == 'true' &&
59+
((github.event_name == 'push' && github.repository == 'JabRef/jabref') ||
60+
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'JabRef/jabref'))
61+
)
4062
runs-on: ubuntu-latest
4163
steps:
4264
- name: Fetch all history for all tags and branches

.github/workflows/tests-code.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ on:
88
pull_request:
99
merge_group:
1010
workflow_dispatch:
11-
11+
# Re-run JBang tests after the SNAPSHOT is updated
12+
workflow_run:
13+
workflows: ["Publish to maven central"]
14+
types:
15+
- completed
1216
env:
1317
AstrophysicsDataSystemAPIKey: ${{ secrets.AstrophysicsDataSystemAPIKey_FOR_TESTS }}
1418
BiodiversityHeritageApiKey: ${{ secrets.BiodiversityHeritageApiKey_FOR_TESTS}}

0 commit comments

Comments
 (0)