-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (92 loc) · 3.21 KB
/
patch.yml
File metadata and controls
109 lines (92 loc) · 3.21 KB
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
name: Patch
on:
push:
branches:
- main
workflow_dispatch:
env:
SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build-patch:
runs-on: ubuntu-latest
if: ${{ contains(github.event.head_commit.message, 'patch') }}
outputs:
patch_number: ${{ steps.shorebird-patch.outputs.patch-number }}
version: ${{ steps.get-version.outputs.VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version
id: get-version
run: |
VERSION=$(grep '^version:' pubspec.yaml | awk '{print $2}')
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: Decode secrets base64
run: |
echo "${{ secrets.ENV }}" | base64 --decode > .env
echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > android/key.properties
echo "${{ secrets.KEYSTORE }}" | base64 --decode > android/anilist-keystore.jks
- name: Decode google-services.json
run: |
mkdir -p android/app/src/prod
echo "${{ secrets.GOOGLE_SERVICES_JSON_PROD }}" | base64 --decode > android/app/src/prod/google-services.json
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
flutter-version: 3.35.3
- run: |
flutter clean
flutter pub get
- name: Generate env
run: |
dart run build_runner clean
dart run build_runner build --define=envied_generator:envied=path=.env
- name: Setup Shorebird
uses: shorebirdtech/setup-shorebird@v1
with:
cache: true
- uses: shorebirdtech/shorebird-patch@v0
id: shorebird-patch
with:
platform: android
args: --release-version ${{ env.VERSION }} -- --flavor prod --dart-define=FLAVOR=prod
- name: Output Patch Number
run: echo ${{ steps.shorebird-patch.outputs.patch-number }}
github-release:
needs: build-patch
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Create version name
run: |
VERSION_CLEAN=$(echo "${{ needs.build-patch.outputs.version }}" | cut -d'+' -f1)
TAG="v${VERSION_CLEAN}-patch${{ needs.build-patch.outputs.patch_number }}"
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Create release notes
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=%B ${GITHUB_SHA})
echo "NOTES<<EOF" >> $GITHUB_ENV
echo "$COMMIT_MESSAGE" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create release tag
run: |
git tag ${{ env.TAG }}
git push origin ${{ env.TAG }}
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ env.TAG }}
release_name: ${{ env.TAG }}
body: ${{ env.NOTES }}
draft: false
prerelease: false