Skip to content

Release

Release #89

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: "The type of version bump. Use `-s` for no change. See docs for details: https://python-poetry.org/docs/cli/#version"
type: choice
required: true
default: "-s"
options:
- major
- minor
- patch
- premajor
- preminor
- prepatch
- prerelease
- prerelease --next-phase
- "-s"
jobs:
prepare:
if: github.repository_owner == 'viamrobotics'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.bump_version.outputs.version }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: poetry
- 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 ${{ inputs.version }}
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: release/v${{ env.SDK_VERSION }}
message: Bump version to ${{ env.SDK_VERSION }}
- name: Open PR
run: |
gh pr create -t "release/v${{ env.SDK_VERSION }}" -b "This is an auto-generated PR to merge the release branch back into main upon successful release" -B "main" -H "release/v${{ env.SDK_VERSION }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
uses: ./.github/workflows/build-wheels.yml
with:
branch: release/v${{ needs.prepare.outputs.version }}
needs: prepare
if: github.repository_owner == 'viamrobotics'
release:
needs: [prepare, build]
if: github.repository_owner == 'viamrobotics'
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: release/v${{ needs.prepare.outputs.version }}