Skip to content

Commit 5fc195b

Browse files
committed
adding publish workflow
1 parent ae3a17e commit 5fc195b

3 files changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/ci-old.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- '.github/workflows/ci-double.yml'
1313
- '.github/workflows/build.yml'
1414
- '.github/workflows/build*.yml'
15+
- '.github/workflows/publish*.yml'
1516
- '.github/actions/test-build/action.yml'
1617
- '.github/actions/build*/*.*'
1718
- '.github/actions/build/*.*'
@@ -51,6 +52,7 @@ on:
5152
- '.github/workflows/ci-double.yml'
5253
- '.github/workflows/build.yml'
5354
- '.github/workflows/build*.yml'
55+
- '.github/workflows/publish*.yml'
5456
- '.github/actions/test-build/action.yml'
5557
- '.github/actions/build*/*.*'
5658
- '.github/actions/build/*.*'

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- '.github/workflows/ci-double.yml'
1313
- '.github/workflows/build.yml'
1414
- '.github/workflows/build*.yml'
15+
- '.github/workflows/publish*.yml'
1516
- '.github/actions/test-build/action.yml'
1617
- '.github/actions/build*/*.*'
1718
- '.github/actions/build/*.*'
@@ -50,6 +51,7 @@ on:
5051
- '.github/workflows/ci-double.yml'
5152
- '.github/workflows/build.yml'
5253
- '.github/workflows/build*.yml'
54+
- '.github/workflows/publish*.yml'
5355
- '.github/actions/test-build/action.yml'
5456
- '.github/actions/build*/*.*'
5557
- '.github/actions/build/*.*'

.github/workflows/publish.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Publish Package
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
id-token: write # Required for OIDC
8+
contents: read
9+
env:
10+
node: 22
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Read package.json
19+
uses: actions/github-script@v7
20+
with:
21+
result-encoding: string
22+
script: |
23+
try {
24+
const fs = require('fs')
25+
const jsonString = fs.readFileSync('package.json')
26+
var json = JSON.parse(jsonString);
27+
core.exportVariable('version', json.version.toString())
28+
} catch(err) {
29+
core.error("Error while reading or parsing package.json")
30+
core.setFailed(err)
31+
}
32+
33+
- uses: actions/setup-node@v4
34+
with:
35+
node-version: ${{ env.node }}
36+
registry-url: 'https://registry.npmjs.org'
37+
38+
# Ensure npm 11.5.1 or later is installed
39+
- run: npm install -g npm@latest
40+
41+
- name: Publish package
42+
run: |
43+
echo "Publishing version ${{ env.version }}"
44+
npm pack --pack-destination package
45+
ls -R package
46+
# npm publish
47+
48+
- name: Upload artifacts
49+
if: success()
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: edge-js-${{ env.version }}
53+
path: |
54+
package/edge-js-${{ env.version }}.tgz
55+
56+
# - name : Tag version
57+
# run: |
58+
# git tag v${{ env.version }}
59+
# git push origin --tags

0 commit comments

Comments
 (0)