Release #55
Workflow file for this run
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: | |
jobs: | |
prepare: | |
if: github.repository_owner == 'viamrobotics' && startsWith(github.ref_name, 'rc-') | |
runs-on: [self-hosted, x64] | |
container: | |
image: ghcr.io/viamrobotics/canon:amd64 | |
outputs: | |
version: ${{ steps.bump_version.outputs.version }} | |
steps: | |
- name: Check if organization member | |
id: is_organization_member | |
uses: jamessingleton/[email protected] | |
with: | |
organization: viamrobotics | |
username: ${{ github.actor }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cancelling - user not part of organization | |
uses: andymckay/[email protected] | |
if: | | |
steps.is_organization_member.outputs.result == 'false' | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- 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: [self-hosted, x64] | |
container: | |
image: ghcr.io/viamrobotics/canon:amd64 | |
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: linux_armv6l | |
ext: so | |
whl: linux_armv6l | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
ref: rc-${{ needs.prepare.outputs.version }} | |
- 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: 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: [self-hosted, x64] | |
container: | |
image: ghcr.io/viamrobotics/canon:amd64 | |
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 }} |