Skip to content

Release

Release #104

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://hatch.pypa.io/latest/version/#supported-segments"
type: choice
required: true
default: "-s"
options:
- major
- minor
- patch
- "-s"
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
id: bump_version
shell: bash
if: inputs.version != '-s' && inputs.prerelease
run: echo "ABC" && uvx hatch version ${{ inputs.version }},${{ inputs.prerelease }}
- name: Bump Version
id: bump_version

Check failure on line 54 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / Release

Invalid workflow file

The workflow is not valid. .github/workflows/release.yml (Line: 54, Col: 13): The identifier 'bump_version' may not be used more than once within the same scope.
shell: bash
if: inputs.version != '-s' && !inputs.prerelease
run: echo "DEF" && 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 }}