Skip to content

Commit

Permalink
Merge branch 'main' into rc-0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
maximpertsov authored Jul 10, 2023
2 parents 74bdaad + 60a3ddb commit e8bd32c
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ on:
jobs:
test:
uses: viamrobotics/viam-typescript-sdk/.github/workflows/test.yml@main

publish_next:
needs: test
uses: viamrobotics/viam-typescript-sdk/.github/workflows/publish_next.yml@main
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
49 changes: 49 additions & 0 deletions .github/workflows/publish_next.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: NPM Publish Next

on:
workflow_call:
secrets:
NPM_TOKEN:
required: true

jobs:
publish_next:
if: github.repository_owner == 'viamrobotics'
runs-on: [self-hosted, x64]
container:
image: ghcr.io/viamrobotics/canon:amd64

steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Build
run: |
sudo chown -R testbot .
sudo -u testbot bash -lc 'make build'
- name: Publish (dry run)
id: check_new_version
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
tag: next
dry-run: true

- name: Validate version name
if: ${{ steps.check_new_version.outputs.type }}
shell: bash
run: |
if [[ ! "$(npm pkg get version)" =~ ^\"[0-9]+\.[0-9]+\.[0-9]\-next\.[0-9]+\"$ ]]; then
echo "::error::Cannot publish an off-cycle version named: $(npm pkg get version). Please run 'make bump-next-version' to generate a valid version name."
exit 1
fi
- name: Publish
if: ${{ steps.check_new_version.outputs.type }}
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
tag: next
2 changes: 2 additions & 0 deletions .github/workflows/release_candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ jobs:
run: |
if ${{ contains(steps.current_version.outputs.current_version, 'rc') }} ; then
npm version prerelease --preid=rc --no-git-tag-version
elif ${{ contains(steps.current_version.outputs.current_version, 'next') && inputs.version == 'prepatch' }} ; then
npm version prerelease --preid=rc --no-git-tag-version
else
npm version ${{ inputs.version }} --preid=rc --no-git-tag-version
fi
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ build-js: $(node_modules) clean-js build-buf
pack: build
npm pack

# bump to the next pre-release version on the `next` distribution tag -
# run this command if you need to publish an off-cycle release of the sdk
.PHONY: bump-next-version
bump-next-version:
npm version --no-git-tag-version prerelease --preid=next

# docs targets

.PHONY: clean-docs
Expand Down

0 comments on commit e8bd32c

Please sign in to comment.