mirror of
https://github.com/DeBrosOfficial/orama.git
synced 2026-06-16 22:54:12 +00:00
ci(publish-sdk): trigger workflow on release
- add release event trigger to automate publishing - update versioning logic to support release tags - conditionally skip git tagging when triggered by release
This commit is contained in:
parent
5ccacb91d6
commit
7c76790ad3
18
.github/workflows/publish-sdk.yml
vendored
18
.github/workflows/publish-sdk.yml
vendored
@ -1,6 +1,8 @@
|
||||
name: Publish SDK to npm
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
@ -41,8 +43,14 @@ jobs:
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Bump version
|
||||
if: inputs.version != ''
|
||||
run: npm version ${{ inputs.version }} --no-git-tag-version
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "release" ]; then
|
||||
VERSION="${{ github.event.release.tag_name }}"
|
||||
VERSION="${VERSION#v}"
|
||||
npm version "$VERSION" --no-git-tag-version
|
||||
elif [ -n "${{ inputs.version }}" ]; then
|
||||
npm version ${{ inputs.version }} --no-git-tag-version
|
||||
fi
|
||||
|
||||
- name: Typecheck
|
||||
run: pnpm typecheck
|
||||
@ -60,18 +68,18 @@ jobs:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Publish
|
||||
if: inputs.dry-run == false
|
||||
if: github.event_name == 'release' || inputs.dry-run != true
|
||||
run: npm publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Get published version
|
||||
if: inputs.dry-run == false
|
||||
if: github.event_name == 'release' || inputs.dry-run != true
|
||||
id: version
|
||||
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create git tag
|
||||
if: inputs.dry-run == false
|
||||
if: github.event_name != 'release' && inputs.dry-run != true
|
||||
working-directory: .
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user