Skip to content
Merged
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
44 changes: 44 additions & 0 deletions .github/workflows/experimental-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Experimental PR Creation

on:
pull_request:
types: [labeled]

jobs:
create-experimental-pr:
if: github.event.label.name == 'experimental'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0

- name: Create or update the experimental branch
run: git push origin main:refs/heads/experimental --force

- name: Checkout the PR branch
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Create PR to experimental
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
SOURCE_BRANCH: ${{ github.event.pull_request.head.ref }}
run: |
gh pr create \
--base experimental \
--head "$SOURCE_BRANCH" \
--title "chore: 🧪 release ($PR_TITLE)" \
--body "This PR was automatically created from #$PR_NUMBER when the 'experimental' label was added.

Merging this PR will trigger an experimental package release to the NPM registry.
You will be able to install it under the experimental tag."
63 changes: 63 additions & 0 deletions .github/workflows/experimental-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Experimental Release

on:
pull_request:
types: [closed]
branches:
- experimental

jobs:
release-experimental:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- run: echo "Hello experimental release"

- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'

- name: Update package versions
run: |
TIMESTAMP=$(date +%s)
VERSION="0.0.0-experimental.$TIMESTAMP"

# Update Core package version
jq ".version = \"$VERSION\"" packages/core/package.json > tmp.json && mv tmp.json packages/core/package.json

# Update CLI package version and the Core dependency
jq ".version = \"$VERSION\"" packages/cli/package.json > tmp.json && mv tmp.json packages/cli/package.json
jq ".dependencies[\"@redocly/openapi-core\"] = \"$VERSION\"" packages/cli/package.json > tmp.json && mv tmp.json packages/cli/package.json

NEW_DESCRIPTION="${{ github.event.pull_request.body }}
---
Experimental release v$VERSION. Install it with \`npm install @redocly/cli@$VERSION\`."

gh pr edit $PR_NUMBER --body "$NEW_DESCRIPTION"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}

- name: Install dependencies
run: npm install

- name: Build packages
run: npm run compile

- name: Publish experimental packages
# env:
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
git diff

cd packages/core
npm publish --tag experimental
cd ../cli
npm publish --tag experimental
2 changes: 1 addition & 1 deletion .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
if ! echo "$PR_TITLE" | grep -E "^(fix|feat|chore|docs)(\([a-z-]+\))?: (🔖 )?[a-z].+[^.]$"; then
if ! echo "$PR_TITLE" | grep -E "^(fix|feat|chore|docs)(\([a-z-]+\))?: (🔖|🧪 )?[a-z].+[^.]$"; then
echo "❌ PR title '$PR_TITLE' does not match the required format"
echo "Required format: type(scope): subject"
echo "Examples:"
Expand Down
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,10 @@ However, you can release a new version with a problematic commit reverted.
Create a new branch from **main**, then find the hash of the commit you want to revert and run `git revert <commit-hash>`.
Create a patch-level changeset for the revert and open a PR with it.
Merge the PR and cut a release according to the [Release flow](#release-flow).

### Experimental release

To release an experimental version to the NPM registry, create a new branch from **main**, then add the `experimental` label to the PR.
This creates a new PR with the `experimental` branch as the source.
Merging this PR triggers an experimental package release to the NPM registry.
You can install it with `npm install @redocly/cli@experimental`.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"OpenAPI linter",
"Swagger linter",
"AsyncAPI linter",
"Arazzo linter",
"oas"
],
"contributors": [
Expand Down
Loading