Release #107
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. Use the blank option for no change. Use the "release" option to promote prerelease. See docs for details: https://hatch.pypa.io/latest/version/#supported-segments' | |
type: choice | |
required: true | |
default: "" | |
options: | |
- major | |
- minor | |
- patch | |
- release | |
- "" | |
prerelease: | |
description: "If this is a prerelease and which type. See docs for details: https://hatch.pypa.io/latest/version/#supported-segments" | |
type: choice | |
required: false | |
options: | |
- "" | |
- "alpha" | |
- "beta" | |
- "rc" | |
jobs: | |
prepare: | |
if: github.repository_owner == 'viamrobotics' | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.set_version.outputs.version }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
- name: Setup Python | |
run: uv python install 3.12 | |
- name: Install Package | |
run: uv sync --all-extras | |
- name: Clean Format Test | |
run: uv run make clean format typecheck test | |
- name: Bump Version | |
shell: bash | |
if: inputs.version != '-s' && inputs.prerelease != '' | |
run: uvx hatch version ${{ inputs.version }},${{ inputs.prerelease }} | |
- name: Bump Version | |
shell: bash | |
if: inputs.version != '-s' && inputs.prerelease == '' | |
run: uvx hatch version ${{ inputs.version }} | |
- name: Set Version | |
id: set_version | |
run: | | |
echo "SDK_VERSION=$(uvx hatch version)" >> $GITHUB_ENV | |
echo "version=$(uvx hatch version)" >> $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 }} |