Release #93
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The type of version bump. Select "nobump" for no version change. See https://github.com/npm/node-semver#functions' | |
type: choice | |
required: true | |
default: nobump | |
options: | |
- major | |
- minor | |
- patch | |
- premajor | |
- preminor | |
- prepatch | |
- nobump # this action is custom for this action and does not exist in npm | |
jobs: | |
prepare: | |
if: github.repository_owner == 'viamrobotics' | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/viamrobotics/canon:amd64 | |
outputs: | |
version: ${{ steps.which_version.outputs.version }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Build + Lint + Test | |
run: | | |
sudo chown -R testbot . | |
sudo -u testbot bash -lc 'make build lint test' | |
- name: Bump Version | |
shell: bash | |
run: npm version ${{ inputs.version }} --no-git-tag-version --preid "b" | |
if: inputs.version != 'nobump' | |
- name: Which Version | |
id: which_version | |
shell: bash | |
run: | | |
echo "version=$(npm pkg get version | sed 's/\"//g')" >> $GITHUB_OUTPUT | |
- name: Check if release exists | |
uses: cardinalby/[email protected] | |
id: release_exists | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
releaseName: v${{ steps.which_version.outputs.version }} | |
doNotFailIfNotFound: 'true' | |
- name: Cancelling - release already exists | |
uses: andymckay/[email protected] | |
if: steps.release_exists.outputs.id != '' | |
- name: Add + Commit | |
uses: EndBug/add-and-commit@v9 | |
with: | |
new_branch: release/v${{ steps.which_version.outputs.version }} | |
message: Bump version to ${{ steps.which_version.outputs.version }} | |
- name: Open PR | |
run: | | |
sudo apt-get install -y gh | |
gh pr create -t "v${{ steps.which_version.outputs.version }}" -b "This is an auto-generated PR to merge the release branch back into main upon successful release" -B "main" -H "release/v${{ steps.which_version.outputs.version }}" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
needs: prepare | |
if: github.repository_owner == 'viamrobotics' | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/viamrobotics/canon:amd64 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
ref: release/v${{ needs.prepare.outputs.version }} | |
- name: Build + Pack | |
run: | | |
sudo chown -R testbot . | |
sudo -u testbot bash -lc 'make build pack' | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: | | |
viamrobotics-sdk-*.tgz | |
docs/dist | |
release: | |
needs: [prepare, build] | |
if: github.repository_owner == 'viamrobotics' | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/viamrobotics/canon:amd64 | |
steps: | |
- uses: actions/download-artifact@v3 | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v${{ needs.prepare.outputs.version }} | |
files: dist/*.tgz | |
draft: true | |
prerelease: false | |
fail_on_unmatched_files: true | |
target_commitish: release/v${{ needs.prepare.outputs.version }} | |
- name: Publish Docs | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: dist/docs/dist | |
publish_branch: docs-gh_pages | |
cname: ts.viam.dev |