Skip to content

Commit 8c7cbed

Browse files
authored
ci(swagger-ui-dist-release): add GA workflow for release (#10498)
1 parent 49fb1c7 commit 8c7cbed

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Release SwaggerUI Dist
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Release SwaggerUI"]
6+
types:
7+
- completed
8+
branches: [ master ]
9+
10+
jobs:
11+
release-swagger-ui-dist:
12+
if: github.event.workflow_run.conclusion == 'success'
13+
name: Release swagger-ui-dist npm package
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
persist-credentials: false
21+
ref: master
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 22
27+
cache: npm
28+
cache-dependency-path: package-lock.json
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Download build artifact
34+
uses: actions/github-script@v7
35+
with:
36+
script: |
37+
const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
run_id: context.payload.workflow_run.id,
41+
});
42+
const matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
43+
return artifact.name == "dist"
44+
})[0];
45+
const download = await github.rest.actions.downloadArtifact({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
artifact_id: matchArtifact.id,
49+
archive_format: 'zip',
50+
});
51+
const fs = require('fs');
52+
fs.writeFileSync('${{github.workspace}}/dist.zip', Buffer.from(download.data));
53+
- run: |
54+
unzip -o dist.zip -d dist
55+
56+
- name: Publish to npmjs.com
57+
run: ./deploy.sh
58+
working-directory: ./swagger-ui-dist-package
59+
env:
60+
NPM_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
61+
PUBLISH_DIST: true

.github/workflows/release-swagger-ui-react.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- run: |
5454
unzip -o dist.zip -d dist
5555
56-
- name: Publish to GitHub Package Registry
56+
- name: Publish to npmjs.com
5757
run: ./run.sh
5858
working-directory: ./flavors/swagger-ui-react/release
5959
env:

0 commit comments

Comments
 (0)