Skip to content

Commit fc63641

Browse files
committed
Release steps
1 parent 7877e79 commit fc63641

File tree

4 files changed

+95
-17
lines changed

4 files changed

+95
-17
lines changed

CONTRIBUTING.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The `main` branch holds
4242
- sources for work-in-progress schema versions in `schemas/vX.Y-dev` folders and their tests in `tests/vX.Y-dev` folders,
4343
- utility scripts and supporting documentation.
4444

45-
Other branches are usually short-lived, for example and for maintaining utility scripts.
45+
Other branches are usually short-lived, for example for maintaining utility scripts.
4646

4747
### Reviewers
4848

@@ -75,6 +75,62 @@ Produce stand-alone HTML files for all work-in-progress specifications in the lo
7575
npm run build-dev
7676
```
7777

78+
## Publishing
79+
80+
### Specification Versions
81+
82+
The specification versions are published to the [spec site](https://spec.openapis.org) by creating an `vX.Y.Z-rel` branch where `versions/X.Y.Z-dev.md` is renamed to `versions/X.Y.Z.md` and then merged to `main`.
83+
This renaming preserves the commit history when using `git log --follow`.
84+
85+
The steps for creating a `vX.Y.Z-rel` branch are:
86+
87+
1. Update `EDITORS.md` in a temporary branch and merge changes back into `main` via pull request
88+
2. Prepare spec files in a temporary branch:
89+
- `npm run format-markdown`
90+
- `npm run build-dev`
91+
- open `deploy-preview/X.Y.Z-dev.html` in browser and verify correct formatting
92+
- adjust and repeat until done
93+
- merge changes back into `main` via pull request
94+
3. Create branch `vX.Y.Z-rel` from `main` in the OAI/Overlay-Specification repo and adjust it
95+
- the bash script `scripts/adjust-release-branch.sh` does this:
96+
- move file `versions/X.Y.Z-dev.md` to `versions/X.Y.Z.md` and replace the release date placeholder `| TBD |` in the history table of Appendix A with the current date
97+
- copy file `EDITORS.md` to `versions/X.Y.Z-editors.md`
98+
- for an X.Y.0 release
99+
- move folder `schemas/vX.Y-dev` to `schemas/vX.Y`
100+
- move folder `tests/vX.Y-dev` to `tests/vX.Y`
101+
4. Merge `vX.Y.Z-rel` into `main` via pull request
102+
5. Archive branch `vX.Y.Z-rel`
103+
104+
HTML renderings of the specification versions are generated from the `versions` folder on `main` by the `respec` workflow on changes to files in that folder, which generates a pull request for publishing the HTML renderings to the [spec site](https://spec.openapis.org/overlay). The workflow can be run manually if required.
105+
106+
Schema iterations are generated from the YAML source files in `schemas/vX.Y` by converting them to JSON, renaming to the relevant last-changed dates, and replacing the `WORK-IN-PROGRESS` placeholders with these dates. This is done by the `schema-publish` workflow on changes to files in these folders, which generates a pull request for publishing the new schema iterations to the [spec site](https://spec.openapis.org/overlay). The workflow can be run manually if required.
107+
108+
<!-- #### Start Next Patch Version
109+
110+
Once the released specification version is published, the next patch version X.Y.(Z+1) can be started:
111+
112+
1. Run bash script `scripts/start-release.sh` in branch `main` to
113+
- create branch `vX.Y-dev-start-X.Y.(Z+1)`
114+
- initialize `src/oas.md` with empty history and content from `versions/X.Y.Z.md`
115+
- change version heading to X.Y.(Z+1) and add a new line to the version history table in Appendix A of `src/oas.md`
116+
- commit and push changes
117+
2. Merge changes into `main` via pull request
118+
119+
#### Start New Minor or Major Version
120+
121+
A new minor version X.(Y+1).0 or major version (X+1).0.0 is started similarly:
122+
123+
1. Create branch `vX'.Y'-dev` from `vX.Y-dev`
124+
2. Run bash script `scripts/start-release.sh` in the new branch to
125+
- create branch `vX'.Y'-dev-start-X'.Y'.0`
126+
- initialize `src/oas.md` with empty history and content from `versions/X.Y.Z.md`
127+
- change version heading to X'.Y'.0 and add a new line to the version history table in Appendix A of `src/oas.md`
128+
- change version in all schema files `src/schemas/validation/.yaml`
129+
- change version in schema test script `tests/schema/schema.test.mjs`
130+
- change version in schema test fixtures in folders `tests/schema/pass` and `tests/schema/fail`
131+
- commit and push changes
132+
3. Merge `vX'.Y'-dev-start-X'.Y'.0` into `vX'.Y'-dev` via pull request -->
133+
78134
## Style guide for Overlay Specification
79135

80136
Some terminology and when to use it:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"scripts": {
4242
"build": "bash ./scripts/md2html/build.sh",
4343
"build-dev": "npm run validate-markdown && bash ./scripts/md2html/build.sh dev && bash ./scripts/schema-publish.sh dev",
44-
"format-markdown": "bash ./scripts/format-markdown.sh *.md schemas/**/*.md versions/*.md",
44+
"format-markdown": "npx markdownlint-cli2 --fix *.md schemas/**/*.md versions/*-dev.md",
4545
"validate-markdown": "markdownlint-cli2 *.md schemas/**/*.md versions/*.md && linkspector check",
4646
"test": "c8 --100 vitest run --coverage"
4747
}

scripts/adjust-release-branch.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
# Author: @ralfhandl
4+
5+
# Run this script from the root of the repo. It is designed to be run manually in a release branch.
6+
7+
branch=$(git branch --show-current)
8+
today=$(date +%Y-%m-%d)
9+
10+
if [[ ! $branch =~ ^v[0-9]+\.[0-9]+\.[0-9]+-rel$ ]]; then
11+
echo "This script is intended to be run from a release branch, e.g. v1.1.0-rel"
12+
exit 1
13+
fi
14+
15+
vVersion=$(basename "$branch" "-rel")
16+
version=${vVersion:1}
17+
echo Prepare release of $version
18+
19+
# create snapshot of current editors
20+
cp EDITORS.md versions/$version-editors.md
21+
22+
# "move" dev version of spec to release version - git will treat this as a rename
23+
# Replace release date placeholder with current date - should only appear in the history table
24+
sed "s/| TBD |/| $today |/g" versions/$version-dev.md > versions/$version.md
25+
# show what changed in the spec - should only be the history table line for the current release
26+
diff -Z versions/$version-dev.md versions/$version.md
27+
# remove dev version of spec
28+
rm versions/$version-dev.md
29+
30+
# rename schemas dev folder and tests folder if present
31+
vMinor=$(echo $vVersion | cut -d. -f1,2)
32+
if [ -d "schemas/$vMinor-dev" ]; then
33+
mv "schemas/$vMinor-dev" "schemas/$vMinor"
34+
fi
35+
if [ -d "tests/$vMinor-dev" ]; then
36+
mv "tests/$vMinor-dev" "tests/$vMinor"
37+
fi

scripts/format-markdown.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)