mirror of
https://github.com/DeBrosOfficial/orama.git
synced 2026-06-17 01:54:13 +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
|
name: Publish SDK to npm
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
@ -41,8 +43,14 @@ jobs:
|
|||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Bump version
|
- name: Bump version
|
||||||
if: inputs.version != ''
|
run: |
|
||||||
run: npm version ${{ inputs.version }} --no-git-tag-version
|
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
|
- name: Typecheck
|
||||||
run: pnpm typecheck
|
run: pnpm typecheck
|
||||||
@ -60,18 +68,18 @@ jobs:
|
|||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
- name: Publish
|
- name: Publish
|
||||||
if: inputs.dry-run == false
|
if: github.event_name == 'release' || inputs.dry-run != true
|
||||||
run: npm publish --access public
|
run: npm publish --access public
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
- name: Get published version
|
- name: Get published version
|
||||||
if: inputs.dry-run == false
|
if: github.event_name == 'release' || inputs.dry-run != true
|
||||||
id: version
|
id: version
|
||||||
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
|
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Create git tag
|
- name: Create git tag
|
||||||
if: inputs.dry-run == false
|
if: github.event_name != 'release' && inputs.dry-run != true
|
||||||
working-directory: .
|
working-directory: .
|
||||||
run: |
|
run: |
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user