-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add snapshot release pipelines (#1853)
* 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 * improve pr description and test publish wihout keys * update contrib and use npm key * rename to snapshot * use npm token * use NODE_AUTH_TOKEN instead * add registry-url
- Loading branch information
Showing
5 changed files
with
118 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Snapshot PR Creation | ||
|
||
on: | ||
pull_request: | ||
types: [labeled] | ||
|
||
jobs: | ||
create-snapshot-pr: | ||
if: github.event.label.name == 'snapshot' | ||
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 snapshot branch | ||
run: git push origin main:refs/heads/snapshot --force | ||
|
||
- name: Checkout the PR branch | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Create PR to snapshot | ||
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 snapshot \ | ||
--head "$SOURCE_BRANCH" \ | ||
--title "chore: 🧪 release ($PR_TITLE)" \ | ||
--body "This PR was automatically created from #$PR_NUMBER when the 'snapshot' label was added. | ||
Merging this PR will trigger a snapshot package release to the NPM registry. | ||
You will be able to install it under the 'snapshot' tag." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Snapshot Release | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- snapshot | ||
|
||
jobs: | ||
release-snapshot: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Update package versions | ||
run: | | ||
TIMESTAMP=$(date +%s) | ||
VERSION="0.0.0-snapshot.$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 snapshot packages | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: | | ||
git diff | ||
cd packages/core | ||
npm publish --tag snapshot | ||
cd ../cli | ||
npm publish --tag snapshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ | |
"OpenAPI linter", | ||
"Swagger linter", | ||
"AsyncAPI linter", | ||
"Arazzo linter", | ||
"oas" | ||
], | ||
"contributors": [ | ||
|
afcdbb4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report
Test suite run success
835 tests passing in 120 suites.
Report generated by 🧪jest coverage report action from afcdbb4