Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: github actions for create-commandkit #59

Merged
merged 4 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/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}}
3 changes: 3 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
- name: 🍳 Prepare
run: pnpm install

- name: 🧱 Build
run: pnpm --filter './packages/*' run build

- name: 🚚 Publish
run: pnpm run deploy:package
env:
Expand Down
3 changes: 1 addition & 2 deletions packages/commandkit/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "commandkit",
"description": "Beginner friendly command & event handler for Discord.js",
"version": "0.1.10",
"version": "0.1.11",
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand All @@ -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
Loading