-
Notifications
You must be signed in to change notification settings - Fork 71
196 lines (180 loc) · 8.36 KB
/
publish.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: Publish
on:
# Enable manual run
workflow_dispatch:
push:
tags:
- "*.*.*"
env:
pkg_name: tachidesk-sorayomi
jobs:
create-build:
name: Create ${{ matrix.target }} build
runs-on: ${{ matrix.os }}
# softprops/action-gh-release needs this permission
permissions:
contents: write
strategy:
# Disable fail-fast as we want results from all even if one fails.
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: android
build_path: build/app/outputs/flutter-apk
- os: macos-latest
target: ios
build_path: build/ios
- os: ubuntu-latest
target: web
build_path: build/web
- os: ubuntu-latest
target: linux
build_path: build/linux/x64/release/bundle
- os: macos-latest # Catalina
target: macos
build_path: build/macos/Build/Products/Release
- os: windows-latest
target: windows
build_path: build\windows\x64\runner\Release
steps:
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install Linux dependencies
if: matrix.target == 'linux'
run: |
sudo apt-get update -y
sudo apt-get install -y libgtk-3-dev libx11-dev pkg-config cmake ninja-build libblkid-dev
- name: Install Android dependencies
if: matrix.target == 'android'
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: "12.x"
- name: Enable desktop support
if: matrix.target != 'android' && matrix.target != 'ios' && matrix.target != 'web'
run: |
flutter config --enable-linux-desktop
flutter config --enable-macos-desktop
flutter config --enable-windows-desktop
- run: flutter doctor -v
- uses: actions/checkout@v3
# - run: flutter create .
- run: flutter pub get
- name: Configure Keystore for Android
if: matrix.target == 'android'
working-directory: android
run: |
echo "${{ secrets.PLAY_STORE_UPLOAD_KEY }}" | base64 --decode > app/upload-keystore.jks
echo "storeFile=upload-keystore.jks" >> key.properties
echo "keyAlias=${{ secrets.KEYSTORE_KEY_ALIAS }}" >> key.properties
echo "storePassword=${{ secrets.KEYSTORE_STORE_PASSWORD }}" >> key.properties
echo "keyPassword=${{ secrets.KEYSTORE_KEY_PASSWORD }}" >> key.properties
- if: matrix.target != 'android' && matrix.target != 'ios'
run: flutter build ${{ matrix.target }} --release
- if: matrix.target == 'android'
run: |
flutter build apk --release
flutter build apk --split-per-abi --release
- if: matrix.target == 'ios'
run: flutter build ios --release --no-codesign
- name: Copy VC redistributables to release directory for Windows
if: matrix.target == 'windows'
working-directory: ${{ matrix.build_path }}
run: |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\msvcp140.dll') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140.dll') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140_1.dll') .
- name: Rename build for Android
if: matrix.target == 'android'
working-directory: ${{ matrix.build_path }}
run: |
mv app-release.apk "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-all.apk"
mv app-arm64-v8a-release.apk "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-arm64-v8a.apk"
mv app-armeabi-v7a-release.apk "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-armeabi-v7a.apk"
mv app-x86_64-release.apk "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x86_64.apk"
- name: Compress build for iOS
if: matrix.target == 'ios'
working-directory: ${{ matrix.build_path }}
run: |
cd iphoneos
mkdir Payload
cd Payload
ln -s ../Runner.app
cd ..
zip -r app-release.ipa Payload
mv app-release.ipa "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}.ipa"
- name: Compress build for Web
if: matrix.target == 'web'
working-directory: ${{ matrix.build_path }}
run: zip -r "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}.zip" *
- name: Compress build for Linux
if: matrix.target == 'linux'
working-directory: ${{ matrix.build_path }}
run: |
cp "$GITHUB_WORKSPACE/scripts/${{ env.pkg_name }}.desktop" .
cp "$GITHUB_WORKSPACE/assets/icons/launcher/sorayomi_icon.png" "./${{ env.pkg_name }}.png"
GZIP=-9 tar czf "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.tar.gz" *
- name: Build deb package
if: matrix.target == 'linux'
run: |
mkdir "build/deb"
mkdir "build/deb/${{ env.pkg_name }}-${{ github.ref_name }}"
cp -r "${{ matrix.build_path }}"/* "build/deb/${{ env.pkg_name }}-${{ github.ref_name }}/"
cp "${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.tar.gz" "build/deb/${{ env.pkg_name }}_${{ github.ref_name }}.orig.tar.gz"
cp -r scripts/debian "build/deb/${{ env.pkg_name }}-${{ github.ref_name }}/"
cd "build/deb/${{ env.pkg_name }}-${{ github.ref_name }}"
sed -i "s/\$pkgver/${{ github.ref_name }}/" debian/changelog
sed -i "s/\$pkgrel/1/" debian/changelog
sudo apt install build-essential devscripts debhelper
debuild --no-lintian -us -uc
cp "../${{ env.pkg_name }}_${{ github.ref_name }}-1_amd64.deb" "$GITHUB_WORKSPACE/"
- name: Compress build for macOS
if: matrix.target == 'macos'
working-directory: ${{ matrix.build_path }}
run: ditto -c -k --sequesterRsrc --keepParent "Tachidesk Sorayomi.app" "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.zip"
- name: Compress build for Windows
if: matrix.target == 'windows'
working-directory: ${{ matrix.build_path }}
run: compress-archive -Path * -DestinationPath "${env:GITHUB_WORKSPACE}\${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.zip"
- name: Create MSI Package
if: matrix.target == 'windows' && startsWith(github.ref, 'refs/tags/')
working-directory: ${{ matrix.build_path }}
run: |
$env:Path += ";C:\Program Files (x86)\WiX Toolset v3.11\bin"
$upgradeCode = [guid]::NewGuid().Guid
Copy-Item "${env:GITHUB_WORKSPACE}\scripts\${{ env.pkg_name }}-x64.wxs" .
Copy-Item "${env:GITHUB_WORKSPACE}\assets\icons\launcher\sorayomi_icon.ico" .
heat dir data -cg data -dr data -sreg -sfrag -gg -o data.wxs
candle -arch x64 -dVersion="${{ github.ref_name }}" -dUpgradeCode="$upgradeCode" -dIcon="sorayomi_icon.ico" "${{ env.pkg_name }}-x64.wxs" data.wxs
light -b data "${{ env.pkg_name }}-x64.wixobj" data.wixobj -o "${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.msi"
Move-Item "${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.msi" "${env:GITHUB_WORKSPACE}"
- name: Add packaged build to release draft
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: false
files: ${{ env.pkg_name }}*
token: ${{ secrets.WINGET }}
winget-publish:
needs: create-build
runs-on: windows-latest # action can only be run on windows
steps:
- name: Update WINGET manifest
uses: vedantmgoyal2009/winget-releaser@v2
with:
identifier: Suwayomi.Tachidesk-Sorayomi
version: ${{ github.ref_name }}
token: ${{ secrets.WINGET }}
homebrew-cask-publish:
needs: create-build
runs-on: macos-latest
steps:
- name: Update Homebrew cask
uses: macauley/action-homebrew-bump-cask@v1
with:
token: ${{secrets.WINGET}}
tap: homebrew/homebrew-cask
cask: tachidesk-sorayomi
livecheck: true