Skip to content

Commit c19b80b

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/hmr-dev-sessions-integrated
2 parents 2d519e5 + 04d143f commit c19b80b

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

.github/workflows/npm_release.yml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@ name: NPM Release
22
on:
33
push:
44
branches:
5-
- main
5+
- main # -> prerelease published under the "next" dist-tag
66
tags:
7-
- "v*"
7+
- "v*" # -> release published under the "latest" dist-tag
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: "Release version to cut, e.g. 9.1.0 (creates tag v<version> and publishes 'latest'). Leave empty for a manual 'next' build."
12+
required: false
13+
default: ""
814

915
env:
1016
NPM_TAG: "next"
@@ -64,8 +70,19 @@ jobs:
6470
run: |
6571
NPM_VERSION=$(node -e "console.log(require('./package.json').version);")
6672
echo NPM_VERSION=$NPM_VERSION >> $GITHUB_ENV
73+
- name: Set manual release version
74+
# manual dispatch with a version: cut tag v<input> and publish ('latest'
75+
# unless the version is a prerelease)
76+
if: ${{ inputs.version != '' }}
77+
env:
78+
INPUT_VERSION: ${{ inputs.version }}
79+
run: |
80+
NPM_VERSION="${INPUT_VERSION#v}"
81+
echo NPM_VERSION=$NPM_VERSION >> $GITHUB_ENV
82+
npm version $NPM_VERSION --no-git-tag-version --allow-same-version
6783
- name: Bump version for dev release
68-
if: ${{ !contains(github.ref, 'refs/tags/') }}
84+
# branch push (main) or manual run without a version -> "next" prerelease
85+
if: ${{ !contains(github.ref, 'refs/tags/') && inputs.version == '' }}
6986
run: |
7087
NPM_VERSION=$(node ./scripts/get-next-version.js)
7188
echo NPM_VERSION=$NPM_VERSION >> $GITHUB_ENV
@@ -201,8 +218,9 @@ jobs:
201218
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
202219
github-release:
203220
runs-on: ubuntu-latest
204-
# only runs on tagged commits
205-
if: ${{ contains(github.ref, 'refs/tags/') }}
221+
# only runs on tagged commits, or a manual dispatch with a version (which
222+
# creates tag v<version> itself via the release action below)
223+
if: ${{ contains(github.ref, 'refs/tags/') || inputs.version != '' }}
206224
permissions:
207225
contents: write
208226
needs:
@@ -239,6 +257,13 @@ jobs:
239257
run: npx conventional-changelog -p angular -r2 > body.md
240258
- uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0
241259
with:
260+
# explicit tag + commit so a manual dispatch (no pushed tag ref) creates
261+
# tag v<version> at the dispatched commit; on tag pushes this resolves
262+
# to the pushed tag itself
263+
tag: "v${{ env.NPM_VERSION }}"
264+
name: "v${{ env.NPM_VERSION }}"
265+
commit: ${{ github.sha }}
242266
artifacts: "dist/nativescript-android-*.tgz,dist/debug-symbols/debug-symbols.zip"
243267
bodyFile: "body.md"
244268
prerelease: ${{needs.build.outputs.npm_tag != 'latest'}}
269+
allowUpdates: true

0 commit comments

Comments
 (0)