Skip to content

Commit

Permalink
add: github actions for create-commandkit
Browse files Browse the repository at this point in the history
  • Loading branch information
notunderctrl committed Feb 2, 2024
1 parent 855609b commit 4b32d5f
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Dev Build
name: (CommandKit) Publish Dev Build

on:
push:
Expand Down Expand Up @@ -39,7 +39,9 @@ jobs:
DEBIAN_FRONTEND: noninteractive

- name: 🚚 Publish
run: pnpm run deploy:package-dev
run: |
cd packages/create-commandkit
npm publish --access public --tag dev
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}

Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/dev-create-commandkit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: (Create CommandKit) Publish Dev Build

on:
push:
branches:
- master
paths:
- 'packages/create-commandkit/**'

jobs:
release:
name: 🚀 Publish Dev 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/create-commandkit
node -e "const pkg = require('./package.json'); \
const newVersion = pkg.version + '-dev.' + 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/create-commandkit
npm publish --access public --tag dev
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}

- name: 🚫 Deprecate Previous Dev Version
run: |
PACKAGE_NAME=$(node -e "console.log(require('./packages/create-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('-dev.'));
const versionToDeprecate = devVersions[devVersions.length - 2];
console.log(versionToDeprecate);
")
echo Deprecating version $VERSION_TO_DEPRECATE
npm deprecate $PACKAGE_NAME@$VERSION_TO_DEPRECATE "Deprecated dev version."
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
1 change: 0 additions & 1 deletion packages/commandkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"dev": "tsup --watch",
"build": "tsup",
"deploy": "npm publish",
"deploy-dev": "npm publish --access public --tag dev",
"test": "vitest",
"test:dev": "cd ./tests && node ../bin/index.mjs dev",
"test:build": "cd ./tests && node ../bin/index.mjs build",
Expand Down
11 changes: 11 additions & 0 deletions packages/create-commandkit/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/node_modules
/src
/tests
/.github
/.vscode
/.git
/.turbo

.DS_Store
tsconfig.json
tsup.config.ts
6 changes: 4 additions & 2 deletions packages/create-commandkit/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "create-commandkit",
"description": "Effortlessly create a CommandKit project",
"version": "2.0.0",
"version": "1.1.4",
"main": "./dist/index.js",
"module": "./dist/index.js",
"bin": "./dist/index.js",
Expand All @@ -28,8 +28,10 @@
},
"homepage": "https://commandkit.js.org",
"scripts": {
"lint": "tsc --noEmit",
"dev": "tsup --watch",
"build": "tsup",
"lint": "tsc"
"deploy": "npm publish"
},
"dependencies": {
"@clack/prompts": "^0.7.0",
Expand Down

0 comments on commit 4b32d5f

Please sign in to comment.