Skip to content

Commit e865fb2

Browse files
chore: 🧪 release (chore: add experimental release pipelines) (#1858)
* chore: add experimental release pipelines * create experimental branch first * create experimental branch first * add experimental-release pipeline * fix prev commit * update pr titles * add release perp flow * update outputs --------- Co-authored-by: Andrew Tatomyr <[email protected]>
1 parent 648fb6c commit e865fb2

File tree

5 files changed

+125
-1
lines changed

5 files changed

+125
-1
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Experimental PR Creation
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
7+
jobs:
8+
create-experimental-pr:
9+
if: github.event.label.name == 'experimental'
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
steps:
16+
- name: Checkout main branch
17+
uses: actions/checkout@v4
18+
with:
19+
ref: main
20+
fetch-depth: 0
21+
22+
- name: Create or update the experimental branch
23+
run: git push origin main:refs/heads/experimental --force
24+
25+
- name: Checkout the PR branch
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Create PR to experimental
31+
env:
32+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
PR_NUMBER: ${{ github.event.pull_request.number }}
34+
PR_TITLE: ${{ github.event.pull_request.title }}
35+
SOURCE_BRANCH: ${{ github.event.pull_request.head.ref }}
36+
run: |
37+
gh pr create \
38+
--base experimental \
39+
--head "$SOURCE_BRANCH" \
40+
--title "chore: 🧪 release ($PR_TITLE)" \
41+
--body "This PR was automatically created from #$PR_NUMBER when the 'experimental' label was added.
42+
43+
Merging this PR will trigger an experimental package release to the NPM registry.
44+
You will be able to install it with \`npm install @redocly/cli@experimental\`."
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Experimental Release
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- experimental
8+
9+
jobs:
10+
release-experimental:
11+
if: github.event.pull_request.merged == true
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
steps:
17+
- run: echo "Hello experimental release"
18+
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 20
25+
cache: 'npm'
26+
27+
- name: Update package versions
28+
run: |
29+
TIMESTAMP=$(date +%s)
30+
VERSION="0.0.0-experimental.$TIMESTAMP"
31+
32+
echo "VERSION=$VERSION"
33+
34+
# Update Core package version
35+
jq ".version = \"$VERSION\"" packages/core/package.json > tmp.json && mv tmp.json packages/core/package.json
36+
37+
# Update CLI package version and the Core dependency
38+
jq ".version = \"$VERSION\"" packages/cli/package.json > tmp.json && mv tmp.json packages/cli/package.json
39+
jq ".dependencies[\"@redocly/openapi-core\"] = \"$VERSION\"" packages/cli/package.json > tmp.json && mv tmp.json packages/cli/package.json
40+
41+
NEW_DESCRIPTION="Experimental release v$VERSION. Install it with \`npm install @redocly/cli@$VERSION\`."
42+
43+
gh pr edit $PR_NUMBER --body "$NEW_DESCRIPTION"
44+
env:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
PR_NUMBER: ${{ github.event.pull_request.number }}
47+
48+
- name: Install dependencies
49+
run: npm install
50+
51+
- name: Build packages
52+
run: npm run compile
53+
54+
# - name: Publish experimental packages
55+
# # env:
56+
# # NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
57+
# run: |
58+
# cd packages/core
59+
# npm publish --tag experimental
60+
# cd ../cli
61+
# npm publish --tag experimental
62+
63+
- name: Publish experimental packages
64+
# env:
65+
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
66+
run: |
67+
git diff
68+
69+
cd packages/core
70+
npm pack --tag experimental
71+
cd ../cli
72+
npm pack --tag experimental

.github/workflows/pr-title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
env:
1313
PR_TITLE: ${{ github.event.pull_request.title }}
1414
run: |
15-
if ! echo "$PR_TITLE" | grep -E "^(fix|feat|chore|docs)(\([a-z-]+\))?: (🔖 )?[a-z].+[^.]$"; then
15+
if ! echo "$PR_TITLE" | grep -E "^(fix|feat|chore|docs)(\([a-z-]+\))?: (🔖|🧪 )?[a-z].+[^.]$"; then
1616
echo "❌ PR title '$PR_TITLE' does not match the required format"
1717
echo "Required format: type(scope): subject"
1818
echo "Examples:"

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,10 @@ However, you can release a new version with a problematic commit reverted.
233233
Create a new branch from **main**, then find the hash of the commit you want to revert and run `git revert <commit-hash>`.
234234
Create a patch-level changeset for the revert and open a PR with it.
235235
Merge the PR and cut a release according to the [Release flow](#release-flow).
236+
237+
### Experimental release
238+
239+
To release an experimental version to the NPM registry, create a new branch from **main**, then add the `experimental` label to the PR.
240+
This creates a new PR with the `experimental` branch as the source.
241+
Merging this PR triggers an experimental package release to the NPM registry.
242+
You can install it with `npm install @redocly/cli@experimental`.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"OpenAPI linter",
5353
"Swagger linter",
5454
"AsyncAPI linter",
55+
"Arazzo linter",
5556
"oas"
5657
],
5758
"contributors": [

0 commit comments

Comments
 (0)