@loopstack/contracts 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
name: 'Publish to NPM Workflow'
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*.*.*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
name: 'Build & Publish to NPM'
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
timeout-minutes: 15
|
|
13
|
+
permissions:
|
|
14
|
+
contents: write
|
|
15
|
+
id-token: write
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout Code
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
fetch-depth: 0
|
|
21
|
+
|
|
22
|
+
- name: Check if tag is on main branch
|
|
23
|
+
run: |
|
|
24
|
+
git fetch origin main
|
|
25
|
+
if ! git branch -r --contains ${{ github.ref }} | grep -q 'origin/main'; then
|
|
26
|
+
echo "❌ Tag is not on main branch"
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
echo "✅ Tag is on main branch"
|
|
30
|
+
|
|
31
|
+
- name: Setup Node.js
|
|
32
|
+
uses: actions/setup-node@v4
|
|
33
|
+
with:
|
|
34
|
+
node-version: '20'
|
|
35
|
+
cache: 'npm'
|
|
36
|
+
registry-url: 'https://registry.npmjs.org'
|
|
37
|
+
|
|
38
|
+
- name: Extract Package Version
|
|
39
|
+
id: package
|
|
40
|
+
run: |
|
|
41
|
+
echo "name=$(node -p "require('./package.json').name")" >> $GITHUB_OUTPUT
|
|
42
|
+
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
|
|
43
|
+
|
|
44
|
+
- name: Validate Version Matches Tag
|
|
45
|
+
run: |
|
|
46
|
+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
|
|
47
|
+
PKG_VERSION=${{ steps.package.outputs.version }}
|
|
48
|
+
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
|
|
49
|
+
echo "❌ Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)"
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
echo "✅ Versions match"
|
|
53
|
+
|
|
54
|
+
- name: Install Dependencies
|
|
55
|
+
run: npm ci
|
|
56
|
+
|
|
57
|
+
- name: Build Package
|
|
58
|
+
run: npm run build --if-present
|
|
59
|
+
|
|
60
|
+
- name: Publish to NPM
|
|
61
|
+
run: npm publish --access public
|
|
62
|
+
env:
|
|
63
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
64
|
+
|
|
65
|
+
- name: Create GitHub Release
|
|
66
|
+
uses: softprops/action-gh-release@v2
|
|
67
|
+
if: success()
|
|
68
|
+
with:
|
|
69
|
+
tag_name: ${{ github.ref_name }}
|
|
70
|
+
body: |
|
|
71
|
+
## 📦 NPM Package
|
|
72
|
+
|
|
73
|
+
**Package:** [${{ steps.package.outputs.name }}](https://www.npmjs.com/package/${{ steps.package.outputs.name }}/v/${{ steps.package.outputs.version }})
|
|
74
|
+
**Version:** ${{ steps.package.outputs.version }}
|
|
75
|
+
|
|
76
|
+
Install with:
|
|
77
|
+
```bash
|
|
78
|
+
npm install ${{ steps.package.outputs.name }}@${{ steps.package.outputs.version }}
|
|
79
|
+
```
|
|
80
|
+
draft: false
|
|
81
|
+
prerelease: false
|
|
82
|
+
env:
|
|
83
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@loopstack/contracts",
|
|
3
3
|
"displayName": "Loopstack Contracts",
|
|
4
4
|
"description": "A collection of types and schemas shared between projects",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.16.0",
|
|
6
6
|
"license": "BSL",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Jakob Klippel",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsc -p tsconfig.json",
|
|
42
42
|
"watch": "tsc --watch",
|
|
43
|
-
"prepare": "npm run build",
|
|
44
43
|
"compile": "tsc --noEmit"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|