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 d2d815c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
mkdir -p dist
cd dist

curl -L \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_REPO/releases?per_page=100" \
-o releases.json

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
24 changes: 24 additions & 0 deletions .github/workflows/sync-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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

- name: Set npm token
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- name: Publish
run: bash .github/workflows/publish.sh
env:
GITHUB_REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_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 d2d815c

Please sign in to comment.