Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,28 @@ jobs:
node-version-file: package.json
registry-url: "https://registry.npmjs.org"
cache: "npm"
- name: Get npm tag
id: npm-tag
run: |
$regex = "^v?(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:[^.]*)))?"
$version = "${{ needs.check.outputs.VERSION }}"
$releaseChannel = $groups["prerelease"][0].value

if ([string]::IsNullOrEmpty($releaseChannel)) {
$releaseChannel = "latest"
}
Write-Output "RELEASE_CHANNEL=$releaseChannel" >> $Env:GITHUB_OUTPUT

- name: Build package
run: |
npm ci
npm run build
- name: Publish to NPM
run: npm publish
run: npm publish --tag ${{ steps.npm-tag.outputs.RELEASE_CHANNEL }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish git release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create ${{ needs.check.outputs.VERSION }} --title "${{ needs.check.outputs.VERSION }}" --generate-notes --target ${{ github.sha }}
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') || ''}}
Loading