Skip to content

Release

Release #79

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 better_imports format 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:
needs: prepare
if: github.repository_owner == 'viamrobotics' && startsWith(github.ref_name, 'rc-')
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: macosx_x86_64
ext: dylib
whl: macosx_10_16_x86_64
- arch: macosx_arm64
ext: dylib
whl: macosx_11_0_arm64
- arch: linux_aarch64
ext: so
whl: manylinux2014_aarch64
- arch: linux_x86_64
ext: so
whl: manylinux2014_x86_64
- arch: musllinux_x86_64
ext: so
whl: musllinux_1_2_x86_64
- arch: linux_armv6l
ext: so
whl: linux_armv6l
- arch: linux_armv6l
ext: so
whl: linux_armv7l
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: rc-${{ needs.prepare.outputs.version }}
- 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: Download binary
run: curl -sL -o src/viam/rpc/libviam_rust_utils.${{ matrix.ext }} https://github.com/viamrobotics/rust-utils/releases/latest/download/libviam_rust_utils-${{ matrix.arch }}.${{ matrix.ext }}
- name: HACK for arm7l
if: ${{ matrix.whl == 'linux_armv7l' }}
run: echo "This file enables arm7l support. PyPI doesn't allow for packages with the same hash, so this file must be added to differentiate this arm7l package from the arm6l package." > src/viam/arm7l.txt
- name: Build
run: poetry build -f wheel
- name: Rename
run: mv dist/viam_sdk-$(poetry run python -c "import viam; print(viam.__version__)")-py3-none-any.whl dist/viam_sdk-$(poetry run python -c "import viam; print(viam.__version__)")-py3-none-${{ matrix.whl }}.whl
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
release:
needs: [prepare, build]
if: github.repository_owner == 'viamrobotics' && startsWith(github.ref_name, 'rc-')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- name: Release
uses: softprops/action-gh-release@v1
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 }}