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 b37da3c
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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
28 changes: 28 additions & 0 deletions .github/workflows/sync-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Sync Release

on:
release:
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Set up Node
uses: actions/setup-node@v4

- run: |
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
- run: |
hash=$(md5sum releases.json | cut -d ' ' -f 1)
echo "exports = require('./releases.json')" > index.js
echo '{"name":"@koishijs/releases","version":"0.0.0-$(echo hash)"}' > package.json
cat package.json
npm publish --access public --tag latest
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 b37da3c

Please sign in to comment.