Skip to content

Commit a4b905b

Browse files
committed
chore: setup sync release workflow
1 parent 8d8c4f9 commit a4b905b

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

.github/workflows/publish.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
mkdir -p releases
2+
3+
cd releases
4+
5+
curl -L \
6+
-H "Accept: application/vnd.github.v3+json" \
7+
-H "Authorization: token $GITHUB_TOKEN" \
8+
"https://api.github.com/repos/$GITHUB_REPO/releases" \
9+
-o releases.json
10+
11+
cat releases.json
12+
13+
hash=$(md5sum releases.json | cut -d ' ' -f 1)
14+
15+
echo "exports = require('./releases.json')" > index.js
16+
17+
echo '{"name":"@koishijs/releases","version":"0.0.0-'$hash'"}' > package.json
18+
19+
cat package.json
20+
21+
npm publish --access public --tag latest

.github/workflows/sync-release.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Sync Release
2+
3+
on:
4+
release:
5+
workflow_dispatch:
6+
7+
jobs:
8+
npm:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Set up Node
12+
uses: actions/setup-node@v4
13+
- name: Publish
14+
run: bash .github/workflows/publish.sh
15+
env:
16+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@root/koishi",
33
"version": "1.0.0",
4+
"type": "module",
45
"private": true,
56
"packageManager": "[email protected]",
67
"workspaces": [

tsconfig.node.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "./tsconfig.base",
3+
"compilerOptions": {
4+
"rootDir": "src",
5+
"emitDeclarationOnly": false,
6+
"noEmit": true,
7+
"module": "esnext",
8+
"moduleResolution": "bundler",
9+
},
10+
"include": [
11+
"scripts",
12+
],
13+
}

0 commit comments

Comments
 (0)