-
Notifications
You must be signed in to change notification settings - Fork 13
62 lines (53 loc) · 1.98 KB
/
next-commandkit.yaml
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
name: (CommandKit) Publish Next Beta Build
on:
push:
branches:
- next
paths:
- 'packages/commandkit/**'
jobs:
release:
name: 🚀 Publish Next Beta Build
runs-on: ubuntu-latest
steps:
- uses: pnpm/action-setup@v2
with:
version: 8
- name: 📚 Checkout
uses: actions/checkout@v3
- name: 🟢 Node
uses: actions/setup-node@v2
with:
node-version: 18
registry-url: https://registry.npmjs.org
- name: 🍳 Prepare
run: pnpm install
- name: 🔢 Update Version
run: |
cd packages/commandkit
node -e "const pkg = require('./package.json'); \
const newVersion = pkg.version + '-next-beta.' + new Date().toISOString().replace(/[:\-T]/g, '').substr(0,14); \
pkg.version = newVersion; \
require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2));"
env:
DEBIAN_FRONTEND: noninteractive
- name: 🚚 Publish
run: |
cd packages/commandkit
npm publish --access public --tag next
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
- name: 🚫 Deprecate Previous Beta Version
run: |
PACKAGE_NAME=$(node -e "console.log(require('./packages/commandkit/package.json').name);")
ALL_VERSIONS=$(npm info $PACKAGE_NAME versions -json)
VERSION_TO_DEPRECATE=$(echo $ALL_VERSIONS | node -e "
const versions = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf-8'));
const devVersions = versions.filter(v => v.includes('-next-beta.'));
const versionToDeprecate = devVersions[devVersions.length - 2];
console.log(versionToDeprecate);
")
echo Deprecating version $VERSION_TO_DEPRECATE
npm deprecate $PACKAGE_NAME@$VERSION_TO_DEPRECATE "Deprecated beta version."
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}