File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -58,16 +58,28 @@ jobs:
58
58
node-version-file : package.json
59
59
registry-url : " https://registry.npmjs.org"
60
60
cache : " npm"
61
+ - name : Get npm tag
62
+ id : npm-tag
63
+ run : |
64
+ $regex = "^v?(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:[^.]*)))?"
65
+ $version = "${{ needs.check.outputs.VERSION }}"
66
+ $releaseChannel = $groups["prerelease"][0].value
67
+
68
+ if ([string]::IsNullOrEmpty($releaseChannel)) {
69
+ $releaseChannel = "latest"
70
+ }
71
+ Write-Output "RELEASE_CHANNEL=$releaseChannel" >> $Env:GITHUB_OUTPUT
72
+
61
73
- name : Build package
62
74
run : |
63
75
npm ci
64
76
npm run build
65
77
- name : Publish to NPM
66
- run : npm publish
78
+ run : npm publish --tag ${{ steps.npm-tag.outputs.RELEASE_CHANNEL }}
67
79
env :
68
80
NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
69
81
- name : Publish git release
70
82
env :
71
83
GH_TOKEN : ${{ github.token }}
72
84
run : |
73
- gh release create ${{ needs.check.outputs.VERSION }} --title "${{ needs.check.outputs.VERSION }}" --generate-notes --target ${{ github.sha }}
85
+ gh release create ${{ needs.check.outputs.VERSION }} --title "${{ needs.check.outputs.VERSION }}" --generate-notes --target ${{ github.sha }} ${{ (steps.npm-tag.outputs.RELEASE_CHANNEL != 'latest' && '--prerelease') || ''}}
You can’t perform that action at this time.
0 commit comments