-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: github actions for create-commandkit
- Loading branch information
1 parent
855609b
commit 4b32d5f
Showing
5 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters