|
8 | 8 | required: true |
9 | 9 | permissions: |
10 | 10 | id-token: write # This is required for requesting the JWT |
11 | | - contents: read # This is required for actions/checkout |
| 11 | + contents: write # This is required for actions/checkout |
12 | 12 | attestations: write # required for provenance |
13 | 13 | jobs: |
14 | 14 | release: |
15 | 15 | runs-on: ubuntu-latest |
16 | 16 | steps: |
17 | 17 | - name: Checkout repository |
18 | 18 | uses: actions/checkout@v5 |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
19 | 21 | - name: Set up JDK 21 |
20 | 22 | uses: actions/setup-java@v5 |
21 | 23 | with: |
|
41 | 43 | - name: Set version in Maven project |
42 | 44 | run: mvn versions:set -DnewVersion=${{ github.event.inputs.versionTag }} -DprocessAllModules |
43 | 45 |
|
| 46 | + - name: Update CITATION.cff (version + date) |
| 47 | + run: | |
| 48 | + VERSION="${{ github.event.inputs.versionTag }}" |
| 49 | + DATE="$(date -u +%Y-%m-%d)" |
| 50 | + |
| 51 | + # top-level fields |
| 52 | + sed -i "s/^version: .*/version: \"${VERSION}\"/" CITATION.cff |
| 53 | + sed -i "s/^date-released: .*/date-released: \"${DATE}\"/" CITATION.cff |
| 54 | + |
| 55 | + # preferred-citation fields (only if present) |
| 56 | + sed -i "s/^\(\s*version:\) .*/\1 \"${VERSION}\"/" CITATION.cff |
| 57 | + |
| 58 | + echo "Updated CITATION.cff to version=${VERSION}, date-released=${DATE}" |
| 59 | +
|
| 60 | + - name: Commit release metadata (pom.xml + CITATION.cff) |
| 61 | + run: | |
| 62 | + git config user.name "github-actions[bot]" |
| 63 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 64 | + |
| 65 | + git add pom.xml */pom.xml CITATION.cff || true |
| 66 | + |
| 67 | + if git diff --cached --quiet; then |
| 68 | + echo "No changes to commit." |
| 69 | + else |
| 70 | + git commit -m "Release ${{ github.event.inputs.versionTag }}" |
| 71 | + git push |
| 72 | + fi |
| 73 | +
|
| 74 | + - name: Create and push git tag |
| 75 | + run: | |
| 76 | + TAG="${{ github.event.inputs.versionTag }}" |
| 77 | + git tag -a "${TAG}" -m "Release ${TAG}" |
| 78 | + git push origin "${TAG}" |
| 79 | +
|
44 | 80 | - name: Build with Maven |
45 | 81 | run: mvn -B package -Prelease --file pom.xml |
46 | 82 |
|
|
0 commit comments