mirror of
https://github.com/Redocly/redoc.git
synced 2025-07-31 02:19:47 +03:00
DOP-3460: Introduce release process (#7)
This commit is contained in:
parent
4667dfaf0e
commit
b9c1391bad
71
.github/workflows/release.yml
vendored
Normal file
71
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
name: Release
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'package.json'
|
||||
- 'cli/package.json'
|
||||
jobs:
|
||||
release-redoc:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ startsWith(github.event.head_commit.message, '[RELEASE] - v') }}
|
||||
env:
|
||||
NPM_BASE_64_AUTH: ${{ secrets.NPM_BASE_64_AUTH }}
|
||||
NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- name: Install dependencies
|
||||
run: npm ci && npm ci --prefix cli
|
||||
- name: Create bundles
|
||||
run: npm run bundle
|
||||
- name: Run unit tests
|
||||
run: npm run test
|
||||
- name: Run e2e tests
|
||||
run: npm run e2e
|
||||
- name: Split commit message
|
||||
uses: jungwinter/split@v2
|
||||
id: split
|
||||
with:
|
||||
msg: ${{ github.event.head_commit.message }}
|
||||
separator: ' - '
|
||||
- name: Push build artifacts and create tag
|
||||
# Use build artifacts in current branch, but only push it to new tag.
|
||||
# Build artifacts are needed by redoc-cli since the dependency is pulled from a GitHub branch/tag.
|
||||
run: |
|
||||
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
git config user.name 'github-actions[bot]'
|
||||
git add -f bundles/ typings/
|
||||
git commit --no-verify -m 'Add build artifacts'
|
||||
git tag ${{ steps.split.outputs._1 }}
|
||||
git push --tags
|
||||
release-redoc-cli:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ startsWith(github.event.head_commit.message, '[RELEASE] - @dop/redoc-cli') }}
|
||||
env:
|
||||
NPM_BASE_64_AUTH: ${{ secrets.NPM_BASE_64_AUTH }}
|
||||
NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- name: Install dependencies
|
||||
run: npm ci && npm ci --prefix cli
|
||||
- name: Create bundles
|
||||
run: npm run bundle
|
||||
- name: Run unit tests
|
||||
run: npm run test
|
||||
- name: Run e2e tests
|
||||
run: npm run e2e
|
||||
- name: Split commit message
|
||||
uses: jungwinter/split@v2
|
||||
id: split
|
||||
with:
|
||||
msg: ${{ github.event.head_commit.message }}
|
||||
separator: ' - '
|
||||
- name: Push build artifacts and create tag
|
||||
run: |
|
||||
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
git config user.name 'github-actions[bot]'
|
||||
git tag ${{ steps.split.outputs._1 }}
|
||||
git push --tags
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -39,3 +39,6 @@ yarn.lock
|
|||
.idea
|
||||
.vscode
|
||||
.eslintcache
|
||||
|
||||
# Test output from redoc-cli
|
||||
redoc-*.html
|
||||
|
|
1
.npmrc
1
.npmrc
|
@ -2,3 +2,4 @@ registry=https://artifactory.corp.mongodb.com/artifactory/api/npm/npm/
|
|||
_auth=${NPM_BASE_64_AUTH}
|
||||
_email=${NPM_EMAIL}
|
||||
_always-auth=true
|
||||
git-tag-version=false
|
||||
|
|
31
README.md
31
README.md
|
@ -40,6 +40,37 @@ With `node` installed, run by doing the following:
|
|||
node <path/to/redoc/cli/index.js> build <path/to/spec/file/or/url> --options=<path/to/options.json> --output=<path/to/custom/output/file/name.html>
|
||||
```
|
||||
|
||||
### Releasing
|
||||
|
||||
The Redoc React component and the Redoc CLI have 2 separate release processes. Because the Redoc CLI pulls its version of Redoc from GitHub, build artifacts are included in the version tag being installed.
|
||||
|
||||
See the sections below for release steps for each component. A release commit will be pushed to the `main` branch of `mongodb-forks/redoc` after following the steps, which will trigger a GitHub workflow. The workflow is responsible for testing, building artifacts (for the Redoc component, if applicable), and creating a tag.
|
||||
|
||||
:warning: Note: Ensure that your local clone of the `mongodb-forks/redoc` repo is clean and up-to-date with the `main` branch. Please check your remotes to ensure that the `upstream` remote is set to the `mongodb-forks/redoc` repo. Example:
|
||||
|
||||
```
|
||||
$ git remote -v
|
||||
upstream https://github.com/mongodb-forks/redoc.git (fetch)
|
||||
upstream https://github.com/mongodb-forks/redoc.git (push)
|
||||
```
|
||||
|
||||
#### Redoc
|
||||
|
||||
Releasing the Redoc React component can be done by:
|
||||
|
||||
1) Go to your local clone of the `mongodb-forks/redoc` repo and ensure you are on the latest iteration of the `main` branch.
|
||||
2) Run `npm version [major | minor | patch | prerelease --preid=rc]`.
|
||||
|
||||
#### Redoc CLI
|
||||
|
||||
Releasing the Redoc CLI can be done by:
|
||||
|
||||
1) Go to your local clone of the `mongodb-forks/redoc` repo and ensure you are on the latest iteration of the `main` branch.
|
||||
2) Go to the `cli/` directory.
|
||||
3) Run `npm install https://github.com/mongodb-forks/redoc.git#{VERSION_TAG}` to update the version of Redoc that the CLI uses.
|
||||
- Example: `npm install https://github.com/mongodb-forks/redoc.git#v1.0.0`. You should see the version set in the CLI's `package.json`.
|
||||
4) Run `npm version [major | minor | patch | prerelease --preid=rc]`.
|
||||
|
||||
## About Redoc
|
||||
|
||||
Redoc is an open-source tool for generating documentation from OpenAPI (fka Swagger) definitions.
|
||||
|
|
4
cli/npm-shrinkwrap.json
generated
4
cli/npm-shrinkwrap.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "redoc-cli",
|
||||
"version": "0.13.20",
|
||||
"version": "0.0.1-test-rc.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "redoc-cli",
|
||||
"version": "0.13.20",
|
||||
"version": "0.0.1-test-rc.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chokidar": "^3.5.1",
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
{
|
||||
"name": "redoc-cli",
|
||||
"version": "0.13.20",
|
||||
"name": "@dop/redoc-cli",
|
||||
"version": "0.0.0",
|
||||
"description": "ReDoc's Command Line Interface",
|
||||
"main": "index.js",
|
||||
"bin": "index.js",
|
||||
"repository": "https://github.com/Redocly/redoc",
|
||||
"author": "Roman Hotsiy <gotsijroman@gmail.com>",
|
||||
"repository": "https://github.com/mongodb-forks/redoc",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"version": "git add -u . && git commit -m \"[RELEASE] - @dop/redoc-cli@$npm_package_version\"",
|
||||
"postversion": "git push upstream main"
|
||||
},
|
||||
"dependencies": {
|
||||
"chokidar": "^3.5.1",
|
||||
"handlebars": "^4.7.7",
|
||||
|
|
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "redoc",
|
||||
"version": "2.0.0",
|
||||
"name": "@dop/redoc",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "redoc",
|
||||
"version": "2.0.0",
|
||||
"name": "@dop/redoc",
|
||||
"version": "0.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@emotion/css": "^11.0.0",
|
||||
|
|
10
package.json
10
package.json
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"name": "redoc",
|
||||
"version": "2.0.0",
|
||||
"name": "@dop/redoc",
|
||||
"version": "0.0.0",
|
||||
"description": "ReDoc",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Redocly/redoc"
|
||||
"url": "https://github.com/mongodb-forks/redoc"
|
||||
},
|
||||
"browserslist": [
|
||||
"defaults"
|
||||
|
@ -59,7 +59,9 @@
|
|||
"license-check": "license-checker --production --onlyAllow 'MIT;ISC;Apache-2.0;BSD;BSD-2-Clause;BSD-3-Clause;CC-BY-4.0;Python-2.0' --summary",
|
||||
"docker:build": "docker build -f config/docker/Dockerfile -t redoc .",
|
||||
"prepare": "husky install",
|
||||
"pre-commit": "pretty-quick --staged && npm run lint"
|
||||
"pre-commit": "pretty-quick --staged && npm run lint",
|
||||
"version": "git add -u . && git commit -m \"[RELEASE] - v$npm_package_version\"",
|
||||
"postversion": "git push upstream main"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cypress/webpack-preprocessor": "^5.12.0",
|
||||
|
|
Loading…
Reference in New Issue
Block a user