chore: migrate from node to bun
This commit is contained in:
@@ -12,14 +12,13 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
bun-version: latest
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Run lint
|
||||
run: npm run lint
|
||||
run: bun run lint
|
||||
|
||||
@@ -12,19 +12,19 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
node-version: '20'
|
||||
bun-version: latest
|
||||
|
||||
- name: Set version from tag
|
||||
run: |
|
||||
VERSION=${GITHUB_REF_NAME#v}
|
||||
echo "Setting package version to $VERSION"
|
||||
npm pkg set version="$VERSION"
|
||||
bun -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json','utf8')); pkg.version='${VERSION}'; fs.writeFileSync('package.json',JSON.stringify(pkg,null,2)+'\n');"
|
||||
SHA=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"https://git.blassanto.me/api/v1/repos/blas/openapi-clean-arch-gen/contents/package.json?ref=main" \
|
||||
| node -e "let d='';process.stdin.on('data',c=>d+=c).on('end',()=>console.log(JSON.parse(d).sha))")
|
||||
| bun -e "let d='';process.stdin.on('data',c=>d+=c).on('end',()=>console.log(JSON.parse(d).sha))")
|
||||
CONTENT=$(base64 -w 0 package.json)
|
||||
curl -s -X PUT \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
@@ -35,21 +35,24 @@ jobs:
|
||||
GITEA_TOKEN: ${{ secrets.TOKEN }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
run: bun run lint
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
run: bun run build
|
||||
|
||||
- name: Configure Gitea registry auth
|
||||
run: |
|
||||
echo "//git.blassanto.me/api/packages/blas/npm/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.bunfig.toml
|
||||
echo '[install.scopes]' >> ~/.bunfig.toml
|
||||
echo '"@blas" = { registry = "https://git.blassanto.me/api/packages/blas/npm/", token = "${NODE_AUTH_TOKEN}" }' >> ~/.bunfig.toml
|
||||
echo "//git.blassanto.me/api/packages/blas/npm/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
|
||||
|
||||
- name: Publish to Gitea
|
||||
run: npm publish
|
||||
run: bun publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user