Skip to content

Commit d2d815c

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

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

.github/workflows/publish.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
mkdir -p dist
2+
cd dist
3+
4+
curl -L \
5+
-H "Accept: application/vnd.github.v3+json" \
6+
-H "Authorization: token $GITHUB_TOKEN" \
7+
"https://api.github.com/repos/$GITHUB_REPO/releases?per_page=100" \
8+
-o releases.json
9+
10+
HASH=$(md5sum releases.json | cut -d ' ' -f 1)
11+
echo '{"name":"@koishijs/releases","main":"releases.json"}' | jq ".version=\"0.0.0-$HASH\"" > package.json
12+
cat package.json
13+
14+
npm publish --access public --tag latest

.github/workflows/sync-release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Sync Release
2+
3+
on:
4+
release:
5+
workflow_dispatch:
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out
12+
uses: actions/checkout@v4
13+
14+
- name: Set up Node
15+
uses: actions/setup-node@v4
16+
17+
- name: Set npm token
18+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
19+
20+
- name: Publish
21+
run: bash .github/workflows/publish.sh
22+
env:
23+
GITHUB_REPO: ${{ github.repository }}
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 1 addition & 0 deletions
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

Lines changed: 13 additions & 0 deletions
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)