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

cd releases

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

on:
release:
workflow_dispatch:

jobs:
npm:
runs-on: ubuntu-latest
steps:
- name: Set up Node
uses: actions/setup-node@v4
- 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 a4b905b

Please sign in to comment.