Skip to content

Commit 9c43626

Browse files
committed
Publish
1 parent baa6c71 commit 9c43626

2 files changed

Lines changed: 44 additions & 3 deletions

File tree

.github/workflows/publish.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+**' # Semver-Tag
7+
8+
permissions:
9+
id-token: write # Required for OIDC
10+
contents: read
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
steps:
16+
17+
# Checkout
18+
- uses: actions/checkout@v4
19+
20+
# Node
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
registry-url: 'https://registry.npmjs.org'
25+
26+
# Deno
27+
- uses: denoland/setup-deno@v2
28+
with:
29+
deno-version: v2.5
30+
31+
# Update
32+
- name: Update
33+
run: npm install npm -g
34+
35+
# Build
36+
- name: Build
37+
run: deno task build
38+
39+
# Publish
40+
- name: Publish
41+
run: npm publish typebox-*.tgz --provenance --access public
42+
working-directory: target/build

tasks.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ const BuildPackage = (target: string = `target/build`) => Task.build.esm('src',
3333
// ------------------------------------------------------------------
3434
// PublishPackage
3535
// ------------------------------------------------------------------
36-
const PublishPackage = async (otp: string, target: string = `target/build`) => {
36+
const PublishPackage = async (target: string = `target/build`) => {
3737
const { version } = JSON.parse(await Task.file(`${target}/package.json`).read())
38-
await Task.shell(`cd ${target} && npm publish typebox-${version}.tgz --access=public --otp ${otp}`)
3938
await Task.shell(`git tag ${version}`)
4039
await Task.shell(`git push origin ${version}`)
4140
}
@@ -58,7 +57,7 @@ Task.run('local', (target: string = `../build-test/node_modules/typebox`) => Bui
5857
// ------------------------------------------------------------------
5958
// Publish
6059
// ------------------------------------------------------------------
61-
Task.run('publish', (otp: string, target: string = `target/build`) => PublishPackage(otp, target))
60+
Task.run('publish', (otp: string, target: string = `target/build`) => PublishPackage(target))
6261
// ------------------------------------------------------------------
6362
// Format
6463
// ------------------------------------------------------------------

0 commit comments

Comments
 (0)