@micha.bigler/ui-core-micha 2.2.10 → 2.2.12

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,118 @@
1
+ name: Publish ui-core-micha to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - "package.json"
9
+ - "pnpm-lock.yaml"
10
+ - "src/**"
11
+ - "tsconfig.build.json"
12
+ workflow_dispatch:
13
+
14
+ jobs:
15
+ publish:
16
+ runs-on: ubuntu-latest
17
+ permissions:
18
+ id-token: write
19
+ contents: read
20
+
21
+ steps:
22
+ - name: Check out code
23
+ uses: actions/checkout@v4
24
+ with:
25
+ fetch-depth: 2
26
+
27
+ - name: Set up Node
28
+ uses: actions/setup-node@v4
29
+ with:
30
+ node-version: '20.x'
31
+ registry-url: 'https://registry.npmjs.org'
32
+
33
+ - name: Decide whether to publish
34
+ id: version_check
35
+ run: |
36
+ node <<'NODE'
37
+ const fs = require('fs');
38
+ const cp = require('child_process');
39
+
40
+ const outputPath = process.env.GITHUB_OUTPUT;
41
+ const githubEvent = process.env.GITHUB_EVENT_NAME || '';
42
+
43
+ function writeOutput(value) {
44
+ fs.appendFileSync(outputPath, `should_publish=${value}\n`, 'utf8');
45
+ }
46
+
47
+ if (githubEvent === 'workflow_dispatch') {
48
+ console.log('Manual dispatch: publish enabled.');
49
+ writeOutput('true');
50
+ process.exit(0);
51
+ }
52
+
53
+ const current = JSON.parse(fs.readFileSync('package.json', 'utf8')).version;
54
+ let previous;
55
+ try {
56
+ previous = JSON.parse(
57
+ cp.execFileSync('git', ['show', 'HEAD^:package.json'], { encoding: 'utf8' })
58
+ ).version;
59
+ } catch (error) {
60
+ console.log('No previous package.json found. Publishing.');
61
+ writeOutput('true');
62
+ process.exit(0);
63
+ }
64
+
65
+ console.log(`Previous version: ${previous}`);
66
+ console.log(`Current version: ${current}`);
67
+
68
+ function parse(version) {
69
+ return version.split('.').map((part) => Number.parseInt(part, 10) || 0);
70
+ }
71
+
72
+ function greaterThan(a, b) {
73
+ const left = parse(a);
74
+ const right = parse(b);
75
+ const maxLength = Math.max(left.length, right.length);
76
+ for (let index = 0; index < maxLength; index += 1) {
77
+ const lv = left[index] || 0;
78
+ const rv = right[index] || 0;
79
+ if (lv > rv) return true;
80
+ if (lv < rv) return false;
81
+ }
82
+ return false;
83
+ }
84
+
85
+ if (greaterThan(current, previous)) {
86
+ console.log('Version increased. Publishing.');
87
+ writeOutput('true');
88
+ } else {
89
+ console.log('Version did not increase. Skipping publish.');
90
+ writeOutput('false');
91
+ }
92
+ NODE
93
+
94
+ - name: Set up pnpm
95
+ if: steps.version_check.outputs.should_publish == 'true'
96
+ uses: pnpm/action-setup@v4
97
+ with:
98
+ version: 10.18.1
99
+
100
+ - name: Show version from package.json
101
+ if: steps.version_check.outputs.should_publish == 'true'
102
+ run: node -e "console.log('Version from package.json:', require('./package.json').version);"
103
+
104
+ - name: Install dependencies (pnpm)
105
+ if: steps.version_check.outputs.should_publish == 'true'
106
+ run: pnpm install --frozen-lockfile
107
+
108
+ - name: Build
109
+ if: steps.version_check.outputs.should_publish == 'true'
110
+ run: pnpm run build
111
+
112
+ - name: Ensure recent npm for trusted publishing
113
+ if: steps.version_check.outputs.should_publish == 'true'
114
+ run: npm install -g npm@latest
115
+
116
+ - name: Publish to npm (Trusted Publishing)
117
+ if: steps.version_check.outputs.should_publish == 'true'
118
+ run: npm publish --access public
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@micha.bigler/ui-core-micha",
3
- "version": "2.2.10",
3
+ "version": "2.2.12",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/bigler-webapps/ui-core-micha"
9
+ },
6
10
  "private": false,
7
11
  "peerDependencies": {
8
12
  "@emotion/react": "^11.0.0",