Release #26
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." | |
type: choice | |
required: true | |
default: nobump | |
options: | |
- major | |
- minor | |
- patch | |
- nobump | |
jobs: | |
prepare: | |
if: github.repository_owner == 'viamrobotics' | |
environment: release | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/cirruslabs/flutter:latest | |
outputs: | |
version: ${{ steps.which_version.outputs.version }} | |
steps: | |
- name: Install GH CLI | |
run: | | |
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) | |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ | |
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ | |
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ | |
&& sudo apt update \ | |
&& sudo apt install gh -y | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- run: git config --global --add safe.directory /__w/viam-flutter-sdk/viam-flutter-sdk | |
- name: Setup Flutter | |
run: flutter pub get | |
- run: make setup | |
- name: Format + Test | |
run: make format test | |
- name: Bump Version | |
if: inputs.version != 'nobump' | |
shell: bash | |
run: $HOME/.pub-cache/bin/cider bump ${{ inputs.version }} | |
- name: Which Version | |
id: which_version | |
shell: bash | |
run: echo "version=$($HOME/.pub-cache/bin/cider version)" >> $GITHUB_OUTPUT | |
- name: Check if release exists | |
uses: cardinalby/[email protected] | |
id: release_exists | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
releaseName: v${{ steps.which_version.outputs.version }} | |
doNotFailIfNotFound: "true" | |
- name: Cancelling - release already exists | |
uses: andymckay/[email protected] | |
if: steps.release_exists.outputs.id != '' | |
- name: Bump Version Metadata | |
run: sed -i -e "s/sdkVersion = 'v[0-9]*\.[0-9]*\.[0-9]*'/sdkVersion = 'v${{ steps.which_version.outputs.version }}'/" lib/src/utils.dart | |
- name: "Generate release changelog" | |
uses: heinrichreimer/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
sinceTag: v0.0.1 | |
futureRelease: v${{ steps.which_version.outputs.version }} | |
unreleased: true | |
repo: viamrobotics/viam-flutter-sdk | |
- name: Add + Commit | |
uses: EndBug/add-and-commit@v9 | |
with: | |
new_branch: release/v${{ steps.which_version.outputs.version }} | |
message: Bump version to ${{ steps.which_version.outputs.version }} | |
- name: Open PR | |
run: | | |
gh pr create -t "v${{ steps.which_version.outputs.version }}" -b "This is an auto-generated PR to merge the release branch back into main upon successful release" -B "main" -H "release/v${{ steps.which_version.outputs.version }}" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
needs: [prepare] | |
if: github.repository_owner == 'viamrobotics' | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/viamrobotics/canon:amd64 | |
steps: | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v${{ needs.prepare.outputs.version }} | |
draft: true | |
prerelease: false | |
target_commitish: release/v${{ needs.prepare.outputs.version }} |