diff --git a/.github/workflows/publish.sh b/.github/workflows/publish.sh new file mode 100644 index 000000000..0408d34ec --- /dev/null +++ b/.github/workflows/publish.sh @@ -0,0 +1,17 @@ +curl -L \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token $GITHUB_TOKEN" \ + "https://api.github.com/repos/$GITHUB_REPO/releases" \ + -o releases.json + +cat releases.json + +hash=$(md5sum releases.json | cut -d ' ' -f 1) + +echo "exports = require('./releases.json')" > index.js + +echo '{"name":"@koishijs/releases","version":"0.0.0-'$hash'"}' > package.json + +cat package.json + +npm publish --access public --tag latest diff --git a/.github/workflows/sync-release.yml b/.github/workflows/sync-release.yml new file mode 100644 index 000000000..c89ac6830 --- /dev/null +++ b/.github/workflows/sync-release.yml @@ -0,0 +1,28 @@ +name: Sync Release + +on: + release: + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Set up Node + uses: actions/setup-node@v4 + + - run: | + curl -L \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token $GITHUB_TOKEN" \ + "https://api.github.com/repos/$GITHUB_REPO/releases" \ + -o releases.json + + - run: | + hash=$(md5sum releases.json | cut -d ' ' -f 1) + echo "exports = require('./releases.json')" > index.js + echo '{"name":"@koishijs/releases","version":"0.0.0-$(echo hash)"}' > package.json + cat package.json + npm publish --access public --tag latest + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 1606d2385..7a1da9871 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "@root/koishi", "version": "1.0.0", + "type": "module", "private": true, "packageManager": "yarn@1.22.19", "workspaces": [ diff --git a/tsconfig.node.json b/tsconfig.node.json new file mode 100644 index 000000000..7d4d94ccc --- /dev/null +++ b/tsconfig.node.json @@ -0,0 +1,13 @@ +{ + "extends": "./tsconfig.base", + "compilerOptions": { + "rootDir": "src", + "emitDeclarationOnly": false, + "noEmit": true, + "module": "esnext", + "moduleResolution": "bundler", + }, + "include": [ + "scripts", + ], +}