Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

Commit f155dd6

Browse files
committed
update some
1 parent 75e3fff commit f155dd6

6 files changed

Lines changed: 41 additions & 71 deletions

File tree

.github/workflows/build.yml

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Test
1+
name: Build and Test and Publish
22

33
on:
44
push:
@@ -13,10 +13,20 @@ on:
1313
type: boolean
1414
default: false
1515

16+
release:
17+
types: [published]
18+
19+
pull_request:
20+
types: [opened, synchronize, reopened]
21+
1622
concurrency:
1723
group: ${{ github.workflow }}-${{ github.ref }}
1824
cancel-in-progress: true
1925

26+
env:
27+
GITHUB_TOKEN: "_DUMMY_"
28+
NODE_AUTH_TOKEN: "_DUMMY_"
29+
2030
jobs:
2131
build-image:
2232
name: Preapre builder image
@@ -86,8 +96,6 @@ jobs:
8696
mkdir -p prefix dist wasm-build cache
8797
chmod o+w prefix dist wasm-build cache
8898
docker compose up ci --no-build
89-
# - name: Check files
90-
# run: ls . */
9199
- name: Install dependencies
92100
run: corepack pnpm install --frozen-lockfile
93101
- name: Run tests
@@ -99,10 +107,11 @@ jobs:
99107
with:
100108
name: libxmlwasm.tgz
101109
path: libxml-wasm-*.tgz
102-
publish_github:
103-
name: Publish to GitHub Packages
110+
publish:
111+
name: Publish packages
104112
runs-on: ubuntu-latest
105113
needs: build
114+
if: ${{ github.event_name != 'pull_request' && !startsWith(github.ref_name, 'dependabot/') }}
106115
permissions:
107116
contents: read
108117
packages: write
@@ -120,20 +129,27 @@ jobs:
120129
tar axf libxml-wasm-*.tgz
121130
mv package/* .
122131
rm -fr package
123-
# - name: Login to GitHub Packages
124-
# run: |
125-
# corepack yarn set npmScopes.libxmlwasm.npmAuthToken ${{ secrets.GITHUB_TOKEN }}
126-
# cat ./.yarnrc.yml
127-
# corepack yarn npm whoami --scope "${{ github.repository_owner }}"
128132
- name: Prepare package
129133
id: package
130134
run: |
131-
./scripts/jqout.sh '.name="@${{ github.repository_owner }}/wasm"' package.json
132-
./scripts/jqout.sh '.version+="-${{ github.ref_name }}-${{ github.sha }}"' package.json
135+
if [ ${{ github.ref_name == 'master' }} ]; then
136+
echo "This is the master branch"
137+
echo "tag=latest" >> $GITHUB_OUTPUT
138+
else
139+
echo "This is the develop branch"
140+
./scripts/jqout.sh '.version+="-${{ github.ref_name }}-${{ github.sha }}"' package.json
141+
echo "tag=experimental" >> $GITHUB_OUTPUT
142+
fi
133143
echo "name=$(jq .name package.json)" >> $GITHUB_OUTPUT
134144
echo "version=$(jq .version package.json)" >> $GITHUB_OUTPUT
135-
- name: Publish package
145+
- name: Publish package to NPM
146+
env:
147+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
148+
run: |
149+
corepack pnpm publish --access public --tag ${{ steps.package.outputs.tag }} --no-git-checks
150+
- name: Publish package to GitHub Package Registry
136151
env:
137152
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138153
run: |
139-
corepack pnpm publish --access public --tag experimental --no-git-checks
154+
./scripts/jqout.sh '.name="@${{ github.repository_owner }}/wasm"' package.json
155+
corepack pnpm publish --access public --tag ${{ steps.package.outputs.tag }} --no-git-checks

.github/workflows/publish.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
@libxmlwasm:registry=https://npm.pkg.github.com
22
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
3+
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}

.yarnrc.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
{
2-
"name": "@libxml/wasm",
3-
"version": "0.0.0",
2+
"name": "libxml.wasm",
3+
"version": "0.0.0-experimental",
44
"packageManager": "pnpm@9.1.0",
55
"type": "module",
66
"types": "types.d.ts",
77
"main": "dist/libxml.cjs",
88
"module": "dist/libxml.mjs",
9+
"exports": {
10+
"./cjs": "./dist/libxml.cjs",
11+
"./esm": "./dist/libxml.mjs",
12+
".": {
13+
"require": "./dist/libxml.cjs",
14+
"imoport": "./dist/libxml.mjs"
15+
}
16+
},
917
"repository": {
1018
"type": "git",
1119
"url": "https://github.com/libxmlwasm/libxml.wasm"

test/libxml.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2-
import { writeFile } from "fs/promises"
3-
// import init from ".."
41
import init from ".."
52

63
const html = `
@@ -24,7 +21,6 @@ const xpath = [
2421
"//div"
2522
]
2623

27-
2824
test("test libxml", async () => {
2925
const libxml = await init()
3026
const doc = libxml.parseHTML(html)

0 commit comments

Comments
 (0)