Skip to content

Commit abf633e

Browse files
authored
ci(release): record each npm publish as a GitHub deployment (#23)
Every release now creates a deployment in an 'npm' environment (marked successful, linking to the published package version) so the Deployments sidebar shows npm releases next to the Vercel Production/Preview entries.
1 parent 11a439a commit abf633e

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,36 @@ jobs:
110110
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
111111
NPM_CONFIG_PROVENANCE: "true"
112112

113+
# Record the npm release as a GitHub deployment so it shows up in the
114+
# repo's Deployments sidebar next to the Vercel Production/Preview entries.
115+
deployment:
116+
needs:
117+
- version
118+
- publish
119+
runs-on: ubuntu-latest
120+
permissions:
121+
deployments: write
122+
steps:
123+
- uses: actions/github-script@v8
124+
env:
125+
VERSION: ${{ needs.version.outputs.version }}
126+
with:
127+
script: |
128+
const version = process.env.VERSION
129+
const deployment = await github.rest.repos.createDeployment({
130+
...context.repo,
131+
ref: context.sha,
132+
environment: "npm",
133+
auto_merge: false,
134+
required_contexts: [],
135+
description: `@synsci/openscience ${version}`,
136+
production_environment: true,
137+
})
138+
await github.rest.repos.createDeploymentStatus({
139+
...context.repo,
140+
deployment_id: deployment.data.id,
141+
state: "success",
142+
environment_url: `https://www.npmjs.com/package/@synsci/openscience/v/${version}`,
143+
description: `Published @synsci/openscience@${version}`,
144+
})
145+

0 commit comments

Comments
 (0)