Skip to content

Commit c4e2bf5

Browse files
feat: add GitHub Actions workflow for npm package publishing
- Add publish-npm-sdk.yml workflow using reusable workflow - Support latest, nightly, and beta tag publishing - Use iExecBlockchainComputing/github-actions-workflows v1.5.0 - Configure for @iexec/web3telegram package scope - Enable manual dispatch with tag selection
1 parent abe4896 commit c4e2bf5

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Publish Package NPM - web3telegram
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'NPM tag to publish (latest or nightly)'
8+
required: true
9+
type: choice
10+
options:
11+
- latest
12+
- nightly
13+
- beta
14+
default: nightly
15+
16+
jobs:
17+
set-publish-version:
18+
# Run only on main branch
19+
if: github.ref == 'refs/heads/main'
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
- name: Set up Node.js
25+
uses: actions/setup-node@v4
26+
- name: Set publish version
27+
id: set-publish-version
28+
if: github.event.inputs.tag == 'nightly'
29+
run: |
30+
if [ "${{ github.event.inputs.tag }}" == "nightly" ]; then
31+
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
32+
NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA::7}"
33+
echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT
34+
else
35+
echo "VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT
36+
fi
37+
outputs:
38+
VERSION: ${{ steps.set-publish-version.outputs.VERSION }}
39+
40+
publish-npm:
41+
# Run only on main branch
42+
if: github.ref == 'refs/heads/main'
43+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
44+
needs: set-publish-version
45+
with:
46+
scope: '@iexec/web3telegram'
47+
registry: 'https://registry.npmjs.org'
48+
node-version: '18'
49+
environment: ${{ github.event.inputs.target }}
50+
tag: ${{ github.event.inputs.tag }}
51+
version: ${{ needs.set-publish-version.outputs.VERSION }}
52+
install-command: |
53+
npm ci
54+
secrets:
55+
npm-token: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)