Skip to content

Commit 72ca298

Browse files
committed
Add automatic npm publishing to release workflow
After building binaries and creating the GitHub Release, the workflow now also publishes the npm package (unrealcli) automatically. Version is extracted from the git tag. Requires NPM_TOKEN secret on the repo.
1 parent b5203f1 commit 72ca298

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,29 @@ jobs:
9494
binaries/ue-cli-linux-arm64
9595
binaries/ue-cli-darwin-amd64
9696
binaries/ue-cli-darwin-arm64
97+
98+
publish-npm:
99+
needs: release
100+
runs-on: ubuntu-latest
101+
102+
steps:
103+
- name: Checkout
104+
uses: actions/checkout@v4
105+
106+
- name: Set up Node.js
107+
uses: actions/setup-node@v4
108+
with:
109+
node-version: '20'
110+
registry-url: 'https://registry.npmjs.org'
111+
112+
- name: Update npm package version from tag
113+
working-directory: cli/npm
114+
run: |
115+
VERSION="${GITHUB_REF_NAME#v}"
116+
npm version "$VERSION" --no-git-tag-version --allow-same-version
117+
118+
- name: Publish to npm
119+
working-directory: cli/npm
120+
env:
121+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
122+
run: npm publish --access public

0 commit comments

Comments
 (0)