Skip to content

Release

Release #83

Workflow file for this run

name: Release
on:
workflow_dispatch:
jobs:
prepare:
if: github.repository_owner == 'viamrobotics' && startsWith(github.ref_name, 'rc-')
runs-on: ubuntu-latest
container:
image: ghcr.io/viamrobotics/canon:amd64
outputs:
version: ${{ steps.which_version.outputs.version }}
steps:
- name: Check if organization member
id: is_organization_member
uses: jamessingleton/[email protected]
with:
organization: viamrobotics
username: ${{ github.actor }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Cancelling - not an organization member
uses: andymckay/[email protected]
if: steps.is_organization_member.outputs.result == 'false'
- 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 $(npm pkg get version | sed -e 's/\"//g' -e 's/-rc.*//g') --no-git-tag-version
- 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: rc-${{ steps.which_version.outputs.version }}
message: Bump version to ${{ steps.which_version.outputs.version }}
- name: Open PR
uses: repo-sync/pull-request@v2
with:
destination_branch: 'main'
pr_title: ${{ steps.which_version.outputs.version }}
pr_body: This is an auto-generated PR to merge the rc branch back into main upon successful release.
build:
needs: prepare
if: github.repository_owner == 'viamrobotics' && startsWith(github.ref_name, 'rc-')
runs-on: ubuntu-latest
container:
image: ghcr.io/viamrobotics/canon:amd64
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: rc-${{ 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' && startsWith(github.ref_name, 'rc-')
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: rc-${{ 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