diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml new file mode 100644 index 00000000..a6142ab6 --- /dev/null +++ b/.github/workflows/release-pr.yml @@ -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' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe5e850d..ee4f85d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/README.md b/README.md index a78f1296..508b57d9 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ node build --options==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", diff --git a/package-lock.json b/package-lock.json index e0919434..02a13ac0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 5cb234d0..1383f4bb 100644 --- a/package.json +++ b/package.json @@ -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",