-
Notifications
You must be signed in to change notification settings - Fork 159
61 lines (48 loc) · 1.75 KB
/
snapshot-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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'
- 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