-
Notifications
You must be signed in to change notification settings - Fork 1
173 lines (149 loc) · 5.37 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Release App
on:
# Only publishes on main (by semantic release)
workflow_dispatch:
inputs:
track:
type: environment
description: Release environment (e.g. test, production)
default: test
force-release:
type: boolean
description: Release even if there's no new version
default: false
whats-new:
type: string
description: What's new text for Play Store (supports escape chars)
# Don't shame me, this is in case I really have nothing new to write :)
default: Nova versão com melhorias funcionais.
concurrency:
group: ${{ github.workflow }}
permissions:
contents: write
jobs:
version:
name: Get new version
runs-on: ubuntu-latest
outputs:
has-new-version: ${{ steps.semantic-release.outputs.new_release_published }}
new-version: ${{ steps.semantic-release.outputs.new_release_version }}
last-version: ${{ steps.semantic-release.outputs.last_release_version }}
steps:
- uses: actions/checkout@v4
- name: 🚚 - Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic-release
with:
dry_run: true
extra_plugins: |
semantic-release-replace-plugin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build App
runs-on: ubuntu-latest
needs: [version]
if: needs.version.outputs.has-new-version == 'true' || ${{ inputs.force-release }}
steps:
- uses: actions/checkout@v4
- name: 📩 - Retrieve the build signature secrets
env:
KEYSTORE: ${{ secrets.KEYSTORE }}
KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }}
run: |
echo -ne "$KEYSTORE" | base64 --decode > android/pessoa-pensadora.jks && \
echo "$KEY_PROPERTIES" > android/key.properties
- name: 💎 - Install Flutter
uses: subosito/[email protected]
with:
flutter-version: '3.x'
channel: 'stable'
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'
# Google Play requires version code (int) to increment on every release
- name: 🔧 - Prepare release
run: |
echo "yyy ${{ needs.version.outputs.last-version }}"
versionCode=$(date '+%y%m%d%H')
sed -i -e "s/version: .*/version: ${{ needs.version.outputs.new-version != '' && needs.version.outputs.new-version || needs.version.outputs.last-version }}+$versionCode/g" pubspec.yaml
- name: 🌱 - Get dependencies
run: cat pubspec.yaml && echo && flutter pub get
- name: 🔨 - Build
run: |
flutter build apk --release --flavor prod
flutter build appbundle --release --flavor prod
- name: 🧹 - Cleanup
run: |
rm android/pessoa-pensadora.jks android/key.properties
mv build/app/outputs/flutter-apk/app-prod-release.apk PessoaPensadora.apk
mv build/app/outputs/bundle/prodRelease/app-prod-release.aab PessoaPensadora.aab
- name: 📦 - Copy APK
uses: actions/upload-artifact@v4
with:
name: PessoaPensadora.apk
path: PessoaPensadora.apk
if-no-files-found: error
- name: 📦 - Copy App Bundle
uses: actions/upload-artifact@v4
with:
name: PessoaPensadora.aab
path: PessoaPensadora.aab
if-no-files-found: error
release:
name: Release
needs: [build]
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: 📦 - Copy server artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true
- name: 🧐 - Display structure of downloaded artifacts
run: ls -R artifacts/
- name: 🚚 - Semantic Release
uses: cycjimmy/semantic-release-action@v4
with:
extra_plugins: |
semantic-release-replace-plugin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-to-google-play:
name: Publish to Google Play
needs: [version, release]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: 'actions/checkout@v4'
- name: 📦 - Copy server artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true
- id: auth
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: projects/${{ vars.GCP_PROJECT_ID }}/locations/global/workloadIdentityPools/${{ vars.GCP_WORKLOAD_IDENTITY_POOL }}/providers/${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.GCP_SERVICE_ACCOUNT }}
- name: Print release notes
run: |
mkdir releaseNotes/
echo -ne "${{ inputs.whats-new }}" > releaseNotes/whatsnew-pt-PT"
- name: Upload to Google Play
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: ${{ steps.auth.outputs.credentials_file_path }}
packageName: me.l3n.pessoapensadora.pessoa_pensadora
releaseFiles: artifacts/PessoaPensadora.aab
track: ${{ vars.RELEASE_TRACK }}
whatsNewDirectory: releaseNotes/
status: draft