Skip to content

Commit

Permalink
chore: setup sync release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Nov 26, 2023
1 parent 8d8c4f9 commit 0eac302
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cd dist

HASH=$(md5sum releases.json | cut -d ' ' -f 1)
echo '{"name":"@koishijs/releases","main":"releases.json"}' | jq ".version=\"0.0.0-$HASH\"" > package.json

cat package.json
npm publish --access public --tag latest
31 changes: 31 additions & 0 deletions .github/workflows/sync-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Sync Release

on:
release:
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4

- run: |
mkdir -p dist
curl -L \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_REPO/releases" \
-o dist/releases.json
cat dist/releases.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish
run: bash .github/workflows/publish.sh
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@root/koishi",
"version": "1.0.0",
"type": "module",
"private": true,
"packageManager": "[email protected]",
"workspaces": [
Expand Down
13 changes: 13 additions & 0 deletions tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "./tsconfig.base",
"compilerOptions": {
"rootDir": "src",
"emitDeclarationOnly": false,
"noEmit": true,
"module": "esnext",
"moduleResolution": "bundler",
},
"include": [
"scripts",
],
}

0 comments on commit 0eac302

Please sign in to comment.