Skip to content
Open
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
2 changes: 0 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ present on the main branch, only on the development branches).
* 3.1.x spec and schemas: v3.1-dev branch
* 3.2.x spec and schemas: v3.2-dev branch
* 3.3.x spec and schemas: v3.3-dev branch
* registry templates: gh-pages branch, registry/...
* registry contents: gh-pages branch, registries/...
* process documentation and build infrastructure: main

Note that we do not accept changes to published specifications.
Expand Down
86 changes: 47 additions & 39 deletions .github/workflows/respec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: respec

# author: @MikeRalphson
# author: @MikeRalphson, @ralfhandl
# issue: https://github.com/OAI/OpenAPI-Specification/issues/1564

#
# This workflow updates the respec 'pretty' rendered versions of the spec
# on the gh-pages branch when the corresponding markdown files change.
# This workflow creates a pull request for publishing HTML spec versions to the spec.openapis.org site.
#

# run this manually from main
Expand All @@ -19,41 +18,50 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5 # checkout main branch
with:
fetch-depth: 0

- uses: actions/setup-node@v5 # setup Node.js
with:
node-version: '20.x'

- name: Install dependencies
run: npm ci

- uses: actions/checkout@v5 # checkout gh-pages branch
with:
ref: gh-pages
path: deploy

- name: run main script
run: scripts/md2html/build.sh

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-respec-version
base: gh-pages
delete-branch: true
path: deploy
labels: Housekeeping
reviewers: earth2marsh,lornajane,mikekistler,miqui,ralfhandl,handrews,karenetheridge
title: Update ReSpec-rendered specification versions
commit-message: Update ReSpec-rendered specification versions
signoff: true
body: |
This pull request is automatically triggered by GitHub action `respec`.

The `versions/*.md` files have changed, so the HTML files are automatically being regenerated.
- name: Generate access token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.OAI_SPEC_PUBLISHER_APPID }}
private-key: ${{ secrets.OAI_SPEC_PUBLISHER_PRIVATE_KEY }}
owner: OAI
repositories: spec.openapis.org

- uses: actions/checkout@v5 # checkout main branch of this repo
with:
fetch-depth: 0

- uses: actions/setup-node@v5 # setup Node.js
with:
node-version: "22.x"

- name: Install dependencies
run: npm ci

- uses: actions/checkout@v5 # checkout main branch of website repo
with:
token: ${{ steps.generate-token.outputs.token }}
repository: OAI/spec.openapis.org
ref: main
path: deploy

- name: run main script
run: scripts/md2html/build.sh

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.generate-token.outputs.token }}
branch: openapi-spec-versions
base: main
delete-branch: true
path: deploy
labels: OpenAPI,Specification
reviewers: earth2marsh,lornajane,mikekistler,miqui,ralfhandl,whitlockjc,handrews,karenetheridge
title: OpenAPI - update ReSpec-rendered specification versions
commit-message: Update ReSpec-rendered specification versions
signoff: true
body: |
This pull request is automatically generated by GitHub action `respec` in the OAI/OpenAPI-Specification repo.

The `versions/*.md` files of the OpenAPI Specification have changed and the corresponding HTML files are regenerated.
90 changes: 49 additions & 41 deletions .github/workflows/schema-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,66 @@ name: schema-publish
# issue: https://github.com/OAI/OpenAPI-Specification/issues/3715

#
# This workflow creates a pull request for publishing schema iterations to the gh-pages branch
# This workflow creates a pull request for publishing schema iterations to the spec.openapis.org site.
#

# run this on push to vX.Y-dev branches or manually
on:
push:
branches:
- 'v[0-9].[0-9]-dev'
- "v[0-9].[0-9]-dev"
paths:
- 'src/schemas/validation/*.yaml'
- 'scripts/schema-publish.sh'
- '.github/workflows/schema-publish.yaml'
- "src/schemas/validation/*.yaml"
workflow_dispatch: {}

jobs:
publish:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5 # checkout main branch
with:
fetch-depth: 0

- uses: actions/setup-node@v5 # setup Node.js
with:
node-version: '22.x'

- name: Install dependencies
run: npm ci

- uses: actions/checkout@v5 # checkout gh-pages branch
with:
ref: gh-pages
path: deploy

- name: run main script
run: scripts/schema-publish.sh

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref_name }}-publish-schema-iteration
base: gh-pages
delete-branch: true
path: deploy
labels: Housekeeping,Schema
reviewers: darrelmiller,webron,earth2marsh,lornajane,mikekistler,miqui,ralfhandl,handrews,karenetheridge
title: '${{ github.ref_name }}: publish OpenAPI schema iterations'
commit-message: New OpenAPI schema iterations
signoff: true
body: |
This pull request is automatically generated by GitHub action `schema-publish`.
The `src/schemas/validation/*.yaml` files have changed and JSON files are automatically generated.
- name: Generate access token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.OAI_SPEC_PUBLISHER_APPID }}
private-key: ${{ secrets.OAI_SPEC_PUBLISHER_PRIVATE_KEY }}
owner: OAI
repositories: spec.openapis.org

- uses: actions/checkout@v5 # checkout main branch of this repo
with:
fetch-depth: 0

- uses: actions/setup-node@v5 # setup Node.js
with:
node-version: "22.x"

- name: Install dependencies
run: npm ci

- uses: actions/checkout@v5 # checkout main branch of website repo
with:
token: ${{ steps.generate-token.outputs.token }}
repository: OAI/spec.openapis.org
ref: main
path: deploy

- name: run main script
run: scripts/schema-publish.sh

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.generate-token.outputs.token }}
branch: openapi-${{ github.ref_name }}-schema-iterations
base: main
delete-branch: true
path: deploy
labels: OpenAPI,Schema
reviewers: earth2marsh,lornajane,mikekistler,miqui,ralfhandl,whitlockjc,handrews,karenetheridge
title: "OpenAPI - publish ${{ github.ref_name }} schema iterations"
commit-message: "New OpenAPI schema iterations published from ${{ github.ref_name }}"
signoff: true
body: |
This pull request is automatically generated by GitHub action `schema-publish` in the OAI/OpenAPI-Specification repo.
The `src/schemas/validation/*.yaml` files have changed and JSON files are automatically generated.
13 changes: 6 additions & 7 deletions scripts/schema-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,18 @@ publish_schema() {
# replace the WORK-IN-PROGRESS placeholders
sed ${sedCmd[@]} $schemaDir/$schema | npx yaml --json --indent 2 --single > $target

# Find the jekyll lander markdown file for this version.
# find the jekyll lander markdown file
local jekyllLander=$(find "$deploydir/$base" -maxdepth 1 -name "*.md")

# Move the jekyll lander markdown for this iteration to the deploy destination.
# The lander files only exist in the gh-pages branch.
# rename or create the jekyll lander markdown file for this iteration
if [ ! -z "$jekyllLander" ]; then
mv $jekyllLander $target.md
echo " * $newestCommitDate: $schema & jekyll lander $(basename $jekyllLander)"
else
# Find the most recent preceding version.
# find the most recent preceding version
local lastdir=""; for fn in $(dirname $deploydir)/?.?; do test "$fn" "<" "$deploydir" && lastdir="$fn"; done
local lastVersion=$(basename $lastdir)
# Find the jekyll lander markdown file for the preceding version.
# find the jekyll lander markdown file for the preceding version
local lastLander=$(find "$lastdir/$base" -maxdepth 1 -name "*.md")

if [ ! -z "$lastLander" ]; then
Expand All @@ -68,7 +67,7 @@ echo === Building schemas into $deploydir
# list of schemas to process, dependent schemas come first
schemas=(meta.yaml dialect.yaml schema.yaml schema-base.yaml)

# publish each schema using its or any of its dependencies newest commit date.
# publish each schema using its or any of its dependencies newest commit date
maxDate=""
sedCmds=()
for schema in "${schemas[@]}"; do
Expand All @@ -81,7 +80,7 @@ for schema in "${schemas[@]}"; do
fi

base=$(basename $schema '.yaml')
# Add the replacement for this schema's placeholder to list of sed commands.
# add the replacement for this schema's placeholder to list of sed commands
sedCmds+=("s/${base}\/WORK-IN-PROGRESS/${base}\/${maxDate}/g")

publish_schema "$schema" "$maxDate" $(printf '%s;' "${sedCmds[@]}")
Expand Down