-
Notifications
You must be signed in to change notification settings - Fork 22
110 lines (93 loc) · 3.7 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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 }}