mirror of
https://github.com/Redocly/redoc.git
synced 2025-07-31 10:29:47 +03:00
DOP-3460: Use PRs for releases (#9)
This commit is contained in:
parent
b9c1391bad
commit
add45a7239
28
.github/workflows/release-pr.yml
vendored
Normal file
28
.github/workflows/release-pr.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: Create Release PR
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'releases/**'
|
||||
jobs:
|
||||
create-release-pr:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Create PR
|
||||
uses: repo-sync/pull-request@v2
|
||||
with:
|
||||
destination_branch: 'main'
|
||||
pr_title: ${{ github.event.head_commit.message }}
|
||||
pr_body: |
|
||||
This is an automated PR.
|
||||
|
||||
Please double-check that:
|
||||
|
||||
- The correct component's version was updated.
|
||||
- The version was updated as intended.
|
||||
- The PR title is in the format "[RELEASE] - "
|
||||
- The PR will be squashed and merged with the same PR title format.
|
||||
- The PR commit description is empty prior to squash merging (i.e. remove "co-authored by" text, if exists).
|
||||
|
||||
For more information, please see the [release](https://github.com/mongodb-forks/redoc/blob/main/.github/workflows/release.yml) workflow.
|
||||
pr_label: 'release'
|
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
|
@ -29,7 +29,6 @@ jobs:
|
|||
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.
|
||||
|
@ -38,11 +37,11 @@ jobs:
|
|||
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 tag ${{ steps.split.outputs._2 }}
|
||||
git push --tags
|
||||
release-redoc-cli:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ startsWith(github.event.head_commit.message, '[RELEASE] - @dop/redoc-cli') }}
|
||||
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 }}
|
||||
|
@ -62,10 +61,9 @@ jobs:
|
|||
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 tag ${{ steps.split.outputs._2 }}
|
||||
git push --tags
|
||||
|
|
|
@ -44,7 +44,7 @@ node <path/to/redoc/cli/index.js> build <path/to/spec/file/or/url> --options=<pa
|
|||
|
||||
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.
|
||||
See the sections below for release steps for each component. A pull request will be made with the necessary release changes. After merging the PR, 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:
|
||||
|
||||
|
@ -60,6 +60,9 @@ 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]`.
|
||||
- A commit should have been pushed to a new `releases/vX.Y.Z` branch.
|
||||
- The creation of the new branch should create a new pull request.
|
||||
3) Approve and merge the new pull request to the `main` branch.
|
||||
|
||||
#### Redoc CLI
|
||||
|
||||
|
@ -70,6 +73,9 @@ Releasing the Redoc CLI can be done by:
|
|||
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]`.
|
||||
- A commit should have been pushed to a new `releases/@dop/redoc-cli@X.Y.Z` branch.
|
||||
- The creation of the new branch should create a new pull request.
|
||||
5) Approve and merge the new pull request to the `main` branch.
|
||||
|
||||
## About Redoc
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
"node": ">=12.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"version": "git add -u . && git commit -m \"[RELEASE] - @dop/redoc-cli@$npm_package_version\"",
|
||||
"postversion": "git push upstream main"
|
||||
"version": "git add -u . && git checkout -b releases/@dop/redoc-cli@$npm_package_version && git commit -m \"[RELEASE] - @dop/redoc-cli@$npm_package_version\"",
|
||||
"postversion": "git push upstream releases/@dop/redoc-cli@$npm_package_version && git checkout - && git branch -D releases/@dop/redoc-cli@$npm_package_version"
|
||||
},
|
||||
"dependencies": {
|
||||
"chokidar": "^3.5.1",
|
||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@dop/redoc",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.1-dop-3460.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@dop/redoc",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.1-dop-3460.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@emotion/css": "^11.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@dop/redoc",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.1-dop-3460.0",
|
||||
"description": "ReDoc",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -60,8 +60,8 @@
|
|||
"docker:build": "docker build -f config/docker/Dockerfile -t redoc .",
|
||||
"prepare": "husky install",
|
||||
"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"
|
||||
"version": "git add -u . && git checkout -b releases/v$npm_package_version && git commit -m \"[RELEASE] - v$npm_package_version\"",
|
||||
"postversion": "git push upstream releases/v$npm_package_version && git checkout - && git branch -D releases/v$npm_package_version"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cypress/webpack-preprocessor": "^5.12.0",
|
||||
|
|
Loading…
Reference in New Issue
Block a user