blob: 8b6245996050c667980ba1e2895944c2aa19ae57 [file]
#
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0,
# or the Eclipse Distribution License v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
# Re-generates the TCK signature file(s) whenever the API module is updated.
# If the generated signature differs from the committed one, a pull request is opened.
# Can also be run manually using workflow_dispatch.
name: Update signature files
on:
push:
branches:
- 'main'
paths:
- 'api/src/**'
workflow_dispatch: # For manual testing
permissions:
contents: write
pull-requests: write
concurrency:
group: update-signature-${{ github.ref }}
cancel-in-progress: false
jobs:
update:
strategy:
max-parallel: 1
matrix:
java-version: [ '17' ] # Add other Java versions if multiple signature files are supported.
name: Update signature file for JDK ${{ matrix.java-version }}
runs-on: ubuntu-latest
env:
SIGNATURE_DIR: tck/tck-tests/src/main/resources/ee/jakarta/tck/jsonp/signaturetest
UPDATE_BRANCH: update-signature-files-${{ github.sha }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
with:
distribution: 'temurin'
java-version: ${{ matrix.java-version }}
cache: 'maven'
- name: Generate signature file
run: |
mvn install -DskipTests -Dmaven.javadoc.skip=true -projects ".,api"
mvn package -DskipTests -Psignature-generation --file tck/pom.xml
- name: Check for changes
id: changes
run: |
git add --intent-to-add "${SIGNATURE_DIR}"
if git diff --quiet -- "${SIGNATURE_DIR}"; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Create pull request
if: steps.changes.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git checkout -b "${UPDATE_BRANCH}"
git add "${SIGNATURE_DIR}"
git commit -s -m "Update signature file for JDK ${{ matrix.java-version }}"
git push origin "${UPDATE_BRANCH}"
gh pr create \
--base "${{ github.ref_name }}" \
--head "${UPDATE_BRANCH}" \
--title "Update signature file for JDK ${{ matrix.java-version }}" \
--body "Generated from ${{ github.sha }} after a change to the API module."