-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (70 loc) · 2.68 KB
/
Copy pathpublish.yml
File metadata and controls
74 lines (70 loc) · 2.68 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Publish to NPM
on:
push:
tags:
- "v*" # Triggers on version tags like v1.0.0, v2.1.3, etc.
workflow_dispatch: # Allows manual triggering from GitHub Actions UI
jobs:
publish:
name: Build and Publish to NPM
runs-on: ubuntu-latest
permissions:
contents: write # create the GitHub Release
id-token: write # mint the OIDC token for npm Trusted Publishing
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
# Trusted Publishing (OIDC) needs npm >= 11.5.1; node 22 bundles npm 10.
- name: Upgrade npm
run: npm install -g npm@latest
- name: Install dependencies
run: npm install
- name: Build package
run: npm run build
- name: Publish to NPM
run: |
VERSION="$(node -p "require('./package.json').version")"
if npm view "@controlplane/schema@${VERSION}" version >/dev/null 2>&1; then
echo "@controlplane/schema@${VERSION} is already published, skipping."
else
npm publish --provenance --access public
fi
- name: Send Slack notification
if: success()
env:
SLACK_NOTIFY_URL: ${{ secrets.SLACK_NOTIFY_URL }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
run: .github/scripts/slack-notify.sh
- name: Extract version
id: version
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
VERSION="${{ github.ref_name }}"
else
# For manual runs, extract version from package.json
VERSION="v$(node -p "require('./package.json').version")"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT
- name: Create GitHub Release
if: success()
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.version }}
name: ${{ steps.version.outputs.version }}
body: |
## Overview
This release updates the TypeScript schema interfaces to reflect the latest definitions from the Control Plane core specification. It ensures consistency with the current OpenAPI models used across Control Plane projects.
## Installation
```bash
npm install @controlplane/schema@${{ steps.version.outputs.version_number }}
```
## Links
- **npm package**: https://www.npmjs.com/package/@controlplane/schema
draft: false
prerelease: false