-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (45 loc) · 1.55 KB
/
lint-and-version-check.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
name: Flutter Lint and Version Check
on:
pull_request:
branches: [ "develop" ]
types: [opened, edited, synchronize]
jobs:
lint-and-version-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.4'
- name: Get dependencies
run: |
cd app
flutter pub get
- name: Run Flutter Analyzer
run: |
cd app
flutter analyze
- name: Check for skip-version-check label
id: label_check
run: |
labels=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
| jq -r '.[].name')
if echo "$labels" | grep -q "skip-version-check"; then
echo "SKIP_VERSION_BUMP=true" >> $GITHUB_ENV
else
echo "SKIP_VERSION_BUMP=false" >> $GITHUB_ENV
fi
- name: Check Version Bump
if: env.SKIP_VERSION_BUMP == 'false'
run: |
cd app
git fetch origin develop
PREV_VERSION=$(git show origin/develop:app/pubspec.yaml | grep '^version:' | awk '{print $2}')
CURR_VERSION=$(grep '^version:' pubspec.yaml | awk '{print $2}')
if [ "$PREV_VERSION" == "$CURR_VERSION" ]; then
echo "Version has not been bumped. Failing the workflow."
exit 1
fi