-
Notifications
You must be signed in to change notification settings - Fork 0
182 lines (182 loc) · 6.24 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
174
175
176
177
178
179
180
181
182
name: Release
on:
push:
tags:
- "*.*.*"
workflow_dispatch:
jobs:
version:
name: Get version
runs-on: ubuntu-latest
outputs:
version: ${{steps.version-generator.outputs.version}}
prev-version: ${{steps.version-generator.outputs.prev-version}}
build-number: ${{steps.version-generator.outputs.build-number}}
steps:
- uses: actions/checkout@v4
- name: Hack around https://github.com/actions/checkout/issues/290
run: |
git fetch --tags --force
- name: Get version, prev version and build number
id: version-generator
shell: bash
run: |
VERSION="$(git describe --tags)"
PREV_VERSION="$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))"
echo "$VERSION"
echo "$PREV_VERSION"
echo ${{github.run_number}}
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "prev-version=$PREV_VERSION" >> "$GITHUB_OUTPUT"
echo "build-number=${{github.run_number}}" >> "$GITHUB_OUTPUT"
changelog:
name: Generate changelog
runs-on: ubuntu-latest
needs: version
steps:
- uses: actions/checkout@v4
- name: Hack around https://github.com/actions/checkout/issues/290
run: |
git fetch --tags --force
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: gradle
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Download changelog_cli
run: dart pub global activate changelog_cli
- name: Generate changelog
id: changelog-generator
run: |
dart pub global run changelog_cli generate -P markdown -s ${{needs.version.outputs.prev-version}} -e ${{needs.version.outputs.version}} > CHANGELOG.md
- name: Upload changelog
uses: actions/upload-artifact@v4
with:
name: changelog
path: CHANGELOG.md
build-apk:
name: Build APK
runs-on: ubuntu-latest
needs: version
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: gradle
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Update version in YAML
run: |
dart pub global activate cider
dart pub global run cider version ${{needs.version.outputs.version}}+${{needs.version.outputs.build-number}}
- name: Download Android keystore
id: android_keystore
uses: timheuer/[email protected]
with:
fileName: keystore.jks
encodedString: ${{ secrets.KEYSTORE_BASE64 }}
- name: Create key.properties
shell: bash
run: |
mkdir -p android
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > android/key.properties
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
- name: Get dependencies
run: flutter pub get
- name: Start Android Release Build
run: flutter build apk
- name: Rename apk
shell: bash
run: |
mv build/app/outputs/flutter-apk/app-release.apk io.github.kirasok.orioks.apk
- name: Upload Android Release
uses: actions/upload-artifact@v4
with:
name: android-release
path: io.github.kirasok.orioks.apk
build-linux:
name: Build linux package
runs-on: ubuntu-latest
needs: version
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: gradle
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Update version in YAML
run: |
dart pub global activate cider
dart pub global run cider version ${{needs.version.outputs.version}}+${{needs.version.outputs.build-number}}
- name: install packages
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev libsecret-1-dev libjsoncpp-dev
- name: Configure Flutter for Linux
run: flutter config --enable-linux-desktop
- name: Start Linux Release Build
run: flutter build linux
- name: Zip Linux Release
uses: montudor/action-zip@v1
with:
args: zip -qq -r io.github.kirasok.orioks.zip build/linux/x64/release/bundle
- name: Upload Linux Release
uses: actions/upload-artifact@v4
with:
name: linux-release
path: io.github.kirasok.orioks.zip
deploy:
name: Deploy Android Build
needs: [build-apk, build-linux, changelog, version]
runs-on: ubuntu-latest
steps:
- name: Get artifacts
id: download
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create Github Release
uses: softprops/[email protected]
with:
tag_name: ${{ needs.version.outputs.version }}
bodyFile: ${{steps.download.outputs.download-path}}/CHANGELOG.md
files: |
${{steps.download.outputs.download-path}}/**/*
build-web:
name: Create and Deploy Web Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: gradle
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Get dependencies
run: flutter pub get
- name: Start Web Release Build
run: flutter build web --release --web-renderer auto --base-href /${{ github.event.repository.name }}/
- name: Deploy to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./build/web # The folder the action should deploy.