Skip to content

Release

Release #80

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
outputs:
version: ${{ steps.bump_version.outputs.version }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install Package
run: poetry install --all-extras
- name: Clean Format Test
run: make clean format typecheck test
- name: Bump Version
id: bump_version
shell: bash
run: |
poetry version $(poetry version -s | sed -e 's/\"//g' -e 's/rc.*//g')
echo "SDK_VERSION=$(poetry version -s)" >> $GITHUB_ENV
echo "version=$(poetry version -s)" >> $GITHUB_OUTPUT
- name: Check if release exists
uses: cardinalby/[email protected]
id: release_exists
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseName: v${{ env.SDK_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-${{ env.SDK_VERSION }}
message: Bump version to ${{ env.SDK_VERSION }}
- name: Open PR
uses: repo-sync/pull-request@v2
with:
destination_branch: "main"
pr_title: rc-${{ env.SDK_VERSION }}
pr_body: This is an auto-generated PR to merge the rc branch back into main upon successful release.
build:
uses: ./.github/workflows/build-wheels.yml
with:
branch: rc-${{ needs.prepare.outputs.version }}
needs: prepare
if: github.repository_owner == 'viamrobotics' && startsWith(github.ref_name, 'rc-')
release:
needs: [prepare, build]
if: github.repository_owner == 'viamrobotics' && startsWith(github.ref_name, 'rc-')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: dist
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.prepare.outputs.version }}
files: dist/**
draft: true
prerelease: false
fail_on_unmatched_files: true
target_commitish: rc-${{ needs.prepare.outputs.version }}