Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/api-only-transcriberj-restdocs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: API-Only TranscriberJ REST Docs Emitter - Build
on:
push:
branches-ignore:
- main
- maintenance
paths:
- 'api-only-transcriberj-restdocs/**'
- '.github/workflows/api-only-transcriberj-restdocs-build.yml'

jobs:
Calculate-Version:
uses: ./.github/workflows/semantic-version-calculate.yml
with:
fail_on_empty_version: false
fail_on_existing_tag: false
project_dir: api-only-transcriberj-restdocs
secrets:
sem_rel_token_token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}

Determine-Release-Type:
needs: Calculate-Version
uses: ./.github/workflows/determine-release-type.yml

Build-api-only-transcriberj-restdocs:
name: Build API-Only TranscriberJ REST Docs Emitter
needs: Calculate-Version
permissions:
contents: read

runs-on: ubuntu-latest

env:
GRADLE_PROPERTIES_FILE: ./api-only-transcriberj-restdocs/gradle.properties
GRADLE_VERSION_REGEX: version\s*=\s*[0-9]\\+\.[0-9]\\+\.[0-9]\\+[a-zA-Z0-9.-]*
VERSION: ${{ needs.Calculate-Version.outputs.next_version }}

steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Java
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
with:
distribution: 'temurin'
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0

- name: Update version in Gradle property file
if: ${{ env.VERSION != '' }}
run: |
echo "VERSION=${{ env.VERSION }}-PRERELEASE"
echo ===== Before - ${{ env.GRADLE_PROPERTIES_FILE }} =====
cat ${{ env.GRADLE_PROPERTIES_FILE }}
sed -i "s/${{ env.GRADLE_VERSION_REGEX }}/version = ${{ env.VERSION }}-PRERELEASE/g" ${{ env.GRADLE_PROPERTIES_FILE }}
echo ===== After - ${{ env.GRADLE_PROPERTIES_FILE }} =====
cat ${{ env.GRADLE_PROPERTIES_FILE }}

- name: Build API-Only TranscriberJ REST Docs Emitter
run: |
cd api-only-transcriberj-restdocs
chmod +x ./gradlew
./gradlew build
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.SEDR_AUTOMATION_TOKEN }}

- name: Upload build reports
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: api-only-transcriberj-restdocs-build-reports
path: api-only-transcriberj-restdocs/build/reports/**

Workflow-Summary:
name: Workflow Summary
needs: [Build-api-only-transcriberj-restdocs, Determine-Release-Type]
if: always()
runs-on: ubuntu-latest
steps:
- name: Output build completion
run: |
echo "API-Only TranscriberJ REST Docs Emitter ${{ needs.Determine-Release-Type.outputs.release_type }} build workflow completed"
echo "::notice title=Build Complete::API-Only TranscriberJ REST Docs Emitter ${{ needs.Determine-Release-Type.outputs.release_type }} build workflow completed"
216 changes: 216 additions & 0 deletions .github/workflows/api-only-transcriberj-restdocs-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
name: API-Only TranscriberJ REST Docs Emitter - Release
on:
push:
branches:
- main
paths:
- 'api-only-transcriberj-restdocs/*.gradle'
- 'api-only-transcriberj-restdocs/gradle/**'
- 'api-only-transcriberj-restdocs/src/main/**'

# ---------------------------------------------------------------------------
# Concurrency control — prevents incorrect semantic version calculation when
# multiple branches are merged to `main` in quick succession.
#
# How it works:
# GitHub Actions assigns every workflow run to the named `group`. If a run
# is already active for that group when a new run is triggered, the new run
# is *queued* (held in a pending state) until the active run finishes.
#
# Why `cancel-in-progress: false`:
# Setting this to `true` would cancel the running workflow and start the
# new one immediately — but that would skip the release entirely for the
# first commit. With `false`, every merged commit is processed in order:
# merge A → run A starts (calculates v1.0.1, tags, publishes)
# merge B → run B queued
# run A finishes → run B starts (now calculates v1.0.2 correctly)
#
# Why a fixed group name instead of `github.ref`:
# Using `github.ref` would create a separate queue per branch. Since all
# releases always come from `main`, a fixed name is equivalent — and makes
# the intention explicit.
# ---------------------------------------------------------------------------
concurrency:
group: api-only-transcriberj-restdocs-release
cancel-in-progress: false

jobs:
Calculate-Version:
uses: ./.github/workflows/semantic-version-calculate.yml
with:
fail_on_empty_version: true
project_dir: api-only-transcriberj-restdocs
DEBUG: true
secrets:
sem_rel_token_token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}

Build:
name: Build API-Only TranscriberJ REST Docs Emitter
needs: Calculate-Version
permissions:
contents: read

runs-on: ubuntu-latest

env:
GRADLE_PROPERTIES_FILE: ./api-only-transcriberj-restdocs/gradle.properties
GRADLE_VERSION_REGEX: version\s*=\s*[0-9]\\+\.[0-9]\\+\.[0-9]\\+[a-zA-Z0-9.-]*
VERSION: ${{ needs.Calculate-Version.outputs.next_version }}

steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Java
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
with:
distribution: 'temurin'
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0

- name: Update version in Gradle property file
run: |
echo "VERSION=${{ env.VERSION }}"
echo ===== Before - ${{ env.GRADLE_PROPERTIES_FILE }} =====
cat ${{ env.GRADLE_PROPERTIES_FILE }}
sed -i "s/${{ env.GRADLE_VERSION_REGEX }}/version = ${{ env.VERSION }}/g" ${{ env.GRADLE_PROPERTIES_FILE }}
echo ===== After - ${{ env.GRADLE_PROPERTIES_FILE }} =====
cat ${{ env.GRADLE_PROPERTIES_FILE }}

- name: Build API-Only TranscriberJ REST Docs Emitter
run: |
cd api-only-transcriberj-restdocs
chmod +x ./gradlew
./gradlew build
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.SEDR_AUTOMATION_TOKEN }}

- name: Upload build reports
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: api-only-transcriberj-restdocs-build-reports
path: api-only-transcriberj-restdocs/build/reports/**

Release-api-only-transcriberj-restdocs:
name: Release API-Only TranscriberJ REST Docs Emitter
needs: [Calculate-Version, Build]
if: ${{ needs.Calculate-Version.outputs.next_version != '' }}
uses: ./.github/workflows/semantic-version-apply.yml
with:
project_dir: api-only-transcriberj-restdocs
secrets:
sem_rel_token_token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}

Publish:
name: Publish API-Only TranscriberJ REST Docs Emitter
needs: [Calculate-Version, Release-api-only-transcriberj-restdocs]
if: ${{ needs.Calculate-Version.outputs.next_version != '' }}
permissions:
contents: read

runs-on: ubuntu-latest

env:
GRADLE_PROPERTIES_FILE: ./api-only-transcriberj-restdocs/gradle.properties
GRADLE_VERSION_REGEX: version\s*=\s*[0-9]\\+\.[0-9]\\+\.[0-9]\\+[a-zA-Z0-9.-]*
VERSION: ${{ needs.Calculate-Version.outputs.next_version }}

steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Java
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
with:
distribution: 'temurin'
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0

- name: Update version in Gradle property file
run: |
echo "VERSION=${{ env.VERSION }}"
echo ===== Before - ${{ env.GRADLE_PROPERTIES_FILE }} =====
cat ${{ env.GRADLE_PROPERTIES_FILE }}
sed -i "s/${{ env.GRADLE_VERSION_REGEX }}/version = ${{ env.VERSION }}/g" ${{ env.GRADLE_PROPERTIES_FILE }}
echo ===== After - ${{ env.GRADLE_PROPERTIES_FILE }} =====
cat ${{ env.GRADLE_PROPERTIES_FILE }}

- name: Publish API-Only TranscriberJ REST Docs Emitter
run: |
cd api-only-transcriberj-restdocs
echo "Publishing to Maven Central via jReleaser"
./gradlew publishMavenPublicationToStagingDeployRepository
./gradlew jreleaserDeploy
env:
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.SIGNING_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSWORD }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.SIGNING_PUBLIC_KEY }}

Update-README:
name: Update README version
needs: [Calculate-Version, Publish]
if: ${{ needs.Calculate-Version.outputs.next_version != '' }}
permissions:
contents: write

runs-on: ubuntu-latest

env:
VERSION: ${{ needs.Calculate-Version.outputs.next_version }}

steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
ref: main
token: ${{ secrets.SEDR_AUTOMATION_TOKEN }}

- name: Update version in api-only-transcriberj-restdocs README
run: |
sed -i -E "s#^\|Latest version \|.*#|Latest version |\`${{ env.VERSION }}\`#" api-only-transcriberj-restdocs/README.adoc
sed -i "s/api-only-transcriberj-restdocs:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[a-zA-Z0-9.-]*/api-only-transcriberj-restdocs:${{ env.VERSION }}/g" api-only-transcriberj-restdocs/README.adoc
sed -i "s|<version>[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[a-zA-Z0-9.-]*</version>|<version>${{ env.VERSION }}</version>|" api-only-transcriberj-restdocs/README.adoc

- name: Upload updated api-only-transcriberj-restdocs README
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: api-only-transcriberj-restdocs-readme-${{ env.VERSION }}
path: api-only-transcriberj-restdocs/README.adoc

- name: Commit and push updated api-only-transcriberj-restdocs README
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add api-only-transcriberj-restdocs/README.adoc
git diff --cached --quiet || git commit -m "docs(api-only-transcriberj-restdocs): update README version to ${{ env.VERSION }} [skip ci]"
git push

Determine-Release-Type:
needs: [Calculate-Version]
uses: ./.github/workflows/determine-release-type.yml

Workflow-Summary:
name: Workflow Summary
needs: [Build, Publish, Update-README, Release-api-only-transcriberj-restdocs, Determine-Release-Type]
if: always()
runs-on: ubuntu-latest
steps:
- name: Output build completion
run: |
echo "API-Only TranscriberJ REST Docs Emitter ${{ needs.Determine-Release-Type.outputs.release_type }} release workflow completed"
echo "::notice title=Release Complete::API-Only TranscriberJ REST Docs Emitter ${{ needs.Determine-Release-Type.outputs.release_type }} release workflow completed"
31 changes: 31 additions & 0 deletions .github/workflows/nvd-cache-refresh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,34 @@ jobs:
reports_subpath: build/reports
secrets:
NVD_APIKEY_SEDR: ${{ secrets.NVD_APIKEY_SEDR }}

Read-Version-Api-Only-TranscriberJ-RestDocs:
name: Read API-Only TranscriberJ REST Docs Emitter Version
needs: refresh-nvd-cache
runs-on: ubuntu-latest
outputs:
version: ${{ steps.read-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 1
persist-credentials: false

- name: Read version from gradle.properties
id: read-version
run: |
VERSION=$(grep -oP 'version\s*=\s*\K\S+' api-only-transcriberj-restdocs/gradle.properties)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

Security-Scan-Api-Only-TranscriberJ-RestDocs:
name: Vulnerability Scan - API-Only TranscriberJ REST Docs Emitter
needs: Read-Version-Api-Only-TranscriberJ-RestDocs
uses: ./.github/workflows/security-scan.yml
with:
project_name: 'api-only-transcriberj-restdocs'
semantic_version: ${{ needs.Read-Version-Api-Only-TranscriberJ-RestDocs.outputs.version }}
fail_on_fatal: true
reports_subpath: build/reports
secrets:
NVD_APIKEY_SEDR: ${{ secrets.NVD_APIKEY_SEDR }}
6 changes: 6 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ Run `./gradlew` from *within* a project's directory, not from the repository roo
|`api-detector-core/`
|Published shared domain model and scanning logic for the SEDR API detector Gradle plugins (Shadow, Mirage, Doppelganger API Detector).

|`api-only-transcriberj-restdocs/`
|Published Spring REST Docs emitter for the API-Only TranscriberJ Gradle plugin: REST Docs companions for the classes it generates from an API contract.

|`nvd-cache-primer/`
|Internal utility project that primes and validates the shared OWASP Dependency-Check NVD cache used by this repository's security-scan workflows. Not published.

Expand All @@ -50,6 +53,9 @@ include::geo-tracker-lens-pack/README.adoc[tag=root,leveloffset=+1]
== api-detector-core
include::api-detector-core/README.adoc[tag=root,leveloffset=+1]

== api-only-transcriberj-restdocs
include::api-only-transcriberj-restdocs/README.adoc[tag=root,leveloffset=+1]

== nvd-cache-primer
include::nvd-cache-primer/README.adoc[tag=root,leveloffset=+1]

Expand Down
32 changes: 32 additions & 0 deletions api-only-transcriberj-restdocs/CONTRIB.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
= Contributing to api-only-transcriberj-restdocs
:toc: left
:icons: font

== Release and CI

This project has independent workflows and release configuration.

* `.github/workflows/api-only-transcriberj-restdocs-build.yml`
* `.github/workflows/api-only-transcriberj-restdocs-release.yml`
* `release.config.js`
* `first-release-patch-analyzer.js`
* `package.json`

Release tags use this module's own scoped namespace (`api-only-transcriberj-restdocs-v*`), independent of the
shared `v*` tag stream used by `sedr-library`. `first-release-patch-analyzer.js` forces the first
real release after the seeded `api-only-transcriberj-restdocs-v0.0.0` baseline tag to compute as `0.0.1`
regardless of the triggering commit's type.

Security scanning does not run from this module's own workflows - it's wired into the shared
`.github/workflows/nvd-cache-refresh.yml` schedule via a `Read-Version-Api-Only-TranscriberJ-RestDocs` /
`Security-Scan-Api-Only-TranscriberJ-RestDocs` job pair, matching the pattern used for `dsl-updater-core`.

== The API-Only TranscriberJ it is built against

The emitter compiles against the TranscriberJ plugin, which carries the emitter interface, and its
tests run the TranscriberJ itself. The plugin is published to the Gradle Plugin Portal from
Arc-E-Tect/SoftwareEngineeringDoneRight-API, at the version `api-only-transcriberj` names in
`gradle/libs.versions.toml`.

To build against a TranscriberJ change that is not released yet, release the TranscriberJ first and
then set its version in the catalog; the CI workflows resolve only released versions.
Loading
Loading