@@ -2,22 +2,17 @@ name: Compile and release production build
22
33on :
44 workflow_dispatch :
5- inputs :
6- version :
7- description : " Version"
8- required : true
9- default : " 1.0.0"
10- number :
11- description : " Build number"
12- required : true
13- default : " 1"
5+
146jobs :
157 build-android :
168 name : Build Android .apk and .aab
179 runs-on : ubuntu-latest
1810 env :
1911 ANDROID_AAB_RELEASE_PATH : build/app/outputs/bundle/release
2012 ANDROID_APK_RELEASE_PATH : build/app/outputs/apk/release
13+ outputs :
14+ VERSION_NAME : ${{ steps.save_version.outputs.version_name }}
15+ VERSION_NUMBER : ${{ steps.save_version.outputs.version_number }}
2116 steps :
2217 - uses : actions/checkout@v3
2318 - name : Decode android/app/keystore.jks
2621 run : echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > android/key.properties
2722 - name : Decode .env
2823 run : echo "${{ secrets.ENV }}" | base64 --decode > .env
29- - name : Update version in YAML
30- run : sed -i 's/99.99.99+99/${{ github.event.inputs.version }}+${{ github.event.inputs.number }}/g' pubspec.yaml
24+ - name : Read pubspec.yaml
25+ uses : JGeek00/read-yaml-files@2.0.0
26+ id : read_pubspec
27+ with :
28+ file : ' ./pubspec.yaml' # File to read from
29+ key-path : ' ["version"]'
30+ - name : Save version on env variable
31+ id : save_version
32+ run : |
33+ version=${{ steps.read_pubspec.outputs.data }}
34+ IFS='+'
35+ read -r -a split <<< "$version"
36+ echo "VERSION_NAME=$(echo ${split[0]})" >> $GITHUB_ENV
37+ echo "version_name=${split[0]}" >> $GITHUB_OUTPUT
38+ echo "version_number=${split[1]}" >> $GITHUB_OUTPUT
3139 - name : Update KeyStore password in gradle properties
3240 run : sed -i 's/#{KEYSTORE_PASS}#/${{ secrets.KEYSTORE_PASS }}/g' android/key.properties
3341 - name : Update KeyStore key password in gradle properties
@@ -44,63 +52,111 @@ jobs:
4452 - run : flutter build apk --release
4553 - run : flutter build appbundle --release
4654 - name : Rename apk
47- run : mv $ANDROID_APK_RELEASE_PATH/app-release.apk $ANDROID_APK_RELEASE_PATH/DroidHole_${{ github.event.inputs.version }}_Android.apk
55+ run : mv $ANDROID_APK_RELEASE_PATH/app-release.apk $ANDROID_APK_RELEASE_PATH/DroidHole_${{ env.VERSION_NAME }}_Android.apk
4856 - name : Rename aab
49- run : mv $ANDROID_AAB_RELEASE_PATH/app-release.aab $ANDROID_AAB_RELEASE_PATH/DroidHole_${{ github.event.inputs.version }}_Android.aab
57+ run : mv $ANDROID_AAB_RELEASE_PATH/app-release.aab $ANDROID_AAB_RELEASE_PATH/DroidHole_${{ env.VERSION_NAME }}_Android.aab
5058 - name : Copy apk to project root
51- run : cp $ANDROID_APK_RELEASE_PATH/DroidHole_${{ github.event.inputs.version }}_Android.apk DroidHole_${{ github.event.inputs.version }}_Android.apk
59+ run : cp $ANDROID_APK_RELEASE_PATH/DroidHole_${{ env.VERSION_NAME }}_Android.apk DroidHole_${{ env.VERSION_NAME }}_Android.apk
5260 - name : Copy aab to project root
53- run : cp $ANDROID_AAB_RELEASE_PATH/DroidHole_${{ github.event.inputs.version }}_Android.aab DroidHole_${{ github.event.inputs.version }}_Android.aab
61+ run : cp $ANDROID_AAB_RELEASE_PATH/DroidHole_${{ env.VERSION_NAME }}_Android.aab DroidHole_${{ env.VERSION_NAME }}_Android.aab
5462 - name : Upload artifact
5563 uses : actions/upload-artifact@v3
5664 with :
5765 name : android
5866 path : |
59- DroidHole_${{ github.event.inputs.version }}_Android.aab
60- DroidHole_${{ github.event.inputs.version }}_Android.apk
67+ DroidHole_${{ env.VERSION_NAME }}_Android.aab
68+ DroidHole_${{ env.VERSION_NAME }}_Android.apk
6169 build-macos :
6270 name : Build macOS .dmg
6371 runs-on : macos-latest
6472 env :
6573 MACOS_APP_RELEASE_PATH : build/macos/Build/Products/Release
74+ outputs :
75+ VERSION_NAME : ${{ steps.save_version.outputs.version_name }}
76+ VERSION_NUMBER : ${{ steps.save_version.outputs.version_number }}
6677 steps :
6778 - uses : actions/checkout@v3
6879 - name : Decode .env
6980 run : echo "${{ secrets.ENV }}" | base64 --decode > .env
70- - name : Update version in YAML
71- run : sed -i '' 's/99.99.99+99/${{ github.event.inputs.version }}+${{ github.event.inputs.number }}/g' pubspec.yaml
81+ - name : Read pubspec.yaml
82+ uses : JGeek00/read-yaml-files@2.0.0
83+ id : read_pubspec
84+ with :
85+ file : ' ./pubspec.yaml'
86+ key-path : ' ["version"]'
87+ - name : Save version on env variable
88+ id : save_version
89+ run : |
90+ version=${{ steps.read_pubspec.outputs.data }}
91+ IFS='+'
92+ read -r -a split <<< "$version"
93+ echo "VERSION_NAME=$(echo ${split[0]})" >> $GITHUB_ENV
94+ echo "version_name=${split[0]}" >> $GITHUB_OUTPUT
95+ echo "version_number=${split[1]}" >> $GITHUB_OUTPUT
7296 - uses : subosito/flutter-action@v2
7397 with :
7498 channel : " stable"
7599 - run : flutter clean
76100 - run : flutter pub get
77101 - run : flutter build macos --release
102+ - name : Install the Apple certificate and sign the application
103+ env :
104+ APPLE_CERTIFICATE : ${{ secrets.APPLE_CERTIFICATE }}
105+ APPLE_CERTIFICATE_PWD : ${{ secrets.APPLE_CERTIFICATE_PWD }}
106+ APPLE_KEYCHAIN_PWD : ${{ secrets.APPLE_KEYCHAIN_PWD }}
107+ APPLE_IDENTITY_ID : ${{ secrets.APPLE_IDENTITY_ID }}
108+ run : |
109+ echo "$APPLE_CERTIFICATE" | base64 --decode > certificate.p12
110+ security create-keychain -p $APPLE_KEYCHAIN_PWD build.keychain
111+ security default-keychain -s build.keychain
112+ security unlock-keychain -p $APPLE_KEYCHAIN_PWD build.keychain
113+ security import certificate.p12 -k build.keychain -P $APPLE_CERTIFICATE_PWD -T /usr/bin/codesign
114+ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $APPLE_KEYCHAIN_PWD build.keychain
115+ /usr/bin/codesign --force -s "$APPLE_IDENTITY_ID" $MACOS_APP_RELEASE_PATH/AdGuard\ Home\ Manager.app -v
78116 - name : Create folder to build dmg
79- run : mkdir $MACOS_APP_RELEASE_PATH/DroidHole
117+ run : mkdir $MACOS_APP_RELEASE_PATH/AdGuard\ Home\ Manager
80118 - name : Copy app into folder
81- run : cp -r $MACOS_APP_RELEASE_PATH/DroidHole .app $MACOS_APP_RELEASE_PATH/DroidHole/DroidHole .app
119+ run : cp -r $MACOS_APP_RELEASE_PATH/AdGuard\ Home\ Manager .app $MACOS_APP_RELEASE_PATH/AdGuard\ Home\ Manager/AdGuard\ Home\ Manager .app
82120 - name : Generate symbolic link to Applications dir
83- run : ln -s /Applications $MACOS_APP_RELEASE_PATH/DroidHole
121+ run : ln -s /Applications $MACOS_APP_RELEASE_PATH/AdGuard\ Home\ Manager
84122 - name : Generate dmg
85- run : hdiutil create -srcfolder $MACOS_APP_RELEASE_PATH/DroidHole $MACOS_APP_RELEASE_PATH/DroidHole_${{ github.event.inputs.version }}_macOS_Universal.dmg
123+ run : hdiutil create -srcfolder $MACOS_APP_RELEASE_PATH/AdGuard\ Home\ Manager $MACOS_APP_RELEASE_PATH/DroidHole_${{ env.VERSION_NAME }}_macOS_Universal.dmg
86124 - name : Copy dmg to project root
87- run : cp $MACOS_APP_RELEASE_PATH/DroidHole_${{ github.event.inputs.version }}_macOS_Universal.dmg DroidHole_${{ github.event.inputs.version }}_macOS_Universal.dmg
125+ run : cp $MACOS_APP_RELEASE_PATH/DroidHole_${{ env.VERSION_NAME }}_macOS_Universal.dmg DroidHole_${{ env.VERSION_NAME }}_macOS_Universal.dmg
88126 - name : Upload artifact
89127 uses : actions/upload-artifact@v3
90128 with :
91129 name : macos
92- path : DroidHole_${{ github.event.inputs.version }}_macOS_Universal.dmg
130+ path : DroidHole_${{ env.VERSION_NAME }}_macOS_Universal.dmg
93131 build-linux :
94132 name : Build Linux .tar.gz and .deb
95133 runs-on : ubuntu-latest
134+ outputs :
135+ VERSION_NAME : ${{ steps.save_version.outputs.version_name }}
136+ VERSION_NUMBER : ${{ steps.save_version.outputs.version_number }}
96137 steps :
97138 - uses : actions/checkout@v3
98139 - name : Decode .env
99140 run : echo "${{ secrets.ENV }}" | base64 --decode > .env
100- - name : Update version in pubspec.yaml
101- run : sed -i 's/99.99.99+99/${{ github.event.inputs.version }}+${{ github.event.inputs.number }}/g' pubspec.yaml
141+ - name : Read pubspec.yaml
142+ uses : JGeek00/read-yaml-files@2.0.0
143+ id : read_pubspec
144+ with :
145+ file : ' ./pubspec.yaml'
146+ key-path : ' ["version"]'
147+ - name : Save version on env variable
148+ id : save_version
149+ run : |
150+ version=${{ steps.read_pubspec.outputs.data }}
151+ IFS='+'
152+ read -r -a split <<< "$version"
153+ echo "VERSION_NAME=$(echo ${split[0]})" >> $GITHUB_ENV
154+ echo "version_name=${split[0]}" >> $GITHUB_OUTPUT
155+ echo "version_number=${split[1]}" >> $GITHUB_OUTPUT
102156 - name : Update version in debian.yaml
103- run : sed -i 's/<REPLACE_VERSION_NUMBER_ACTIONS>/${{ github.event.inputs.version }}/g' debian/debian.yaml
157+ run : sed -i 's/<REPLACE_VERSION_NUMBER_ACTIONS>/${{ env.VERSION_NAME }}/g' debian/debian.yaml
158+ - name : Update dependencies list
159+ run : sudo apt-get update
104160 - name : Install dependencies
105161 run : sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
106162 - uses : subosito/flutter-action@v2
@@ -114,7 +170,7 @@ jobs:
114170 - name : Generate .deb package
115171 run : flutter_to_debian
116172 - name : Move .deb package to project root
117- run : mv debian/packages/ DroidHole_${{ github.event.inputs.version }}_amd64.deb DroidHole_${{ github.event.inputs.version }}_Linux_amd64.deb
173+ run : mv build/linux/x64/release/debian/ DroidHole_${{ env.VERSION_NAME }}_amd64.deb DroidHole_${{ env.VERSION_NAME }}_Linux_amd64.deb
118174 - name : Generate .tar.gz package
119175 uses : a7ul/tar-action@v1.1.3
120176 id : compress
@@ -124,31 +180,47 @@ jobs:
124180 files : |
125181 ./data
126182 ./lib
127- ./DroidHole
128- outPath : DroidHole_${{ github.event.inputs.version }}_Linux.tar.gz
183+ ./AdGuardHomeManager
184+ outPath : DroidHole_${{ env.VERSION_NAME }}_Linux.tar.gz
129185 - name : Upload artifact
130186 uses : actions/upload-artifact@v3
131187 with :
132188 name : linux
133189 path : |
134- DroidHole_${{ github.event.inputs.version }}_Linux_amd64.deb
135- DroidHole_${{ github.event.inputs.version }}_Linux.tar.gz
190+ DroidHole_${{ env.VERSION_NAME }}_Linux_amd64.deb
191+ DroidHole_${{ env.VERSION_NAME }}_Linux.tar.gz
136192 build-windows :
137193 name : Build Windows installer
138194 runs-on : windows-latest
195+ outputs :
196+ VERSION_NAME : ${{ steps.save_version.outputs.version_name }}
197+ VERSION_NUMBER : ${{ steps.save_version.outputs.version_number }}
139198 steps :
140199 - uses : actions/checkout@v3
141200 - name : Decode .env
142201 shell : pwsh
143202 run : |
144203 [IO.File]::WriteAllBytes('.env', [Convert]::FromBase64String('${{ secrets.ENV }}'))
145- - name : Update version in pubspec.yaml
204+ - name : Read pubspec.yaml
205+ uses : JGeek00/read-yaml-files@2.0.0
206+ id : read_pubspec
207+ with :
208+ file : ' ./pubspec.yaml'
209+ key-path : ' ["version"]'
210+ - name : Save version on env variable
146211 shell : bash
147- run : sed -i 's/99.99.99+99/${{ github.event.inputs.version }}+${{ github.event.inputs.number }}/g' pubspec.yaml
212+ id : save_version
213+ run : |
214+ version=${{ steps.read_pubspec.outputs.data }}
215+ IFS='+'
216+ read -r -a split <<< "$version"
217+ echo "VERSION_NAME=$(echo ${split[0]})" >> $GITHUB_ENV
218+ echo "version_name=${split[0]}" >> $GITHUB_OUTPUT
219+ echo "version_number=${split[1]}" >> $GITHUB_OUTPUT
148220 - name : Update version in innosetup config file
149221 shell : pwsh
150222 run : |
151- (Get-Content windows/innosetup_installer_builder.iss) -replace '<REPLACE_VERSION_ACTIONS>', '${{ github.event.inputs.version }}' | Out-File -encoding ASCII windows/innosetup_installer_builder.iss
223+ (Get-Content windows/innosetup_installer_builder.iss) -replace '<REPLACE_VERSION_ACTIONS>', '${{ env.VERSION_NAME }}' | Out-File -encoding ASCII windows/innosetup_installer_builder.iss
152224 - uses : subosito/flutter-action@v2
153225 with :
154226 channel : " stable"
@@ -158,16 +230,19 @@ jobs:
158230 - name : Build installer witn innosetup
159231 run : iscc /Q windows/innosetup_installer_builder.iss
160232 - name : Move installer file to root directory
161- run : move build/windows/droidhole_installer.exe DroidHole_${{ github.event.inputs.version }}_Windows_x64.exe
233+ run : move build/windows/droidhole_installer.exe DroidHole_${{ env.VERSION_NAME }}_Windows_x64.exe
162234 - name : Upload artifact
163235 uses : actions/upload-artifact@v3
164236 with :
165237 name : windows
166- path : DroidHole_${{ github.event.inputs.version }}_Windows_x64.exe
238+ path : DroidHole_${{ env.VERSION_NAME }}_Windows_x64.exe
167239 release-builds-github :
168240 name : Release builds to GitHub
169241 runs-on : ubuntu-latest
170242 needs : [build-android, build-macos, build-linux, build-windows]
243+ env :
244+ VERSION_NAME : ${{ needs.build-android.outputs.VERSION_NAME }}
245+ VERSION_NUMBER : ${{ needs.build-android.outputs.VERSION_NUMBER }}
171246 steps :
172247 - uses : actions/checkout@v3
173248 - name : Create builds directory
@@ -197,15 +272,17 @@ jobs:
197272 with :
198273 artifacts : " releases/*"
199274 token : ${{ secrets.GH_TOKEN }}
200- tag : ' ${{ github.event.inputs.version }}_(${{ github.event.inputs.number }})'
201- name : v${{ github.event.inputs.version }}
275+ tag : ' ${{ env.VERSION_NAME }}_(${{ env.VERSION_NUMBER }})'
276+ name : v${{ env.VERSION_NAME }}
202277 draft : true
203278 prerelease : false
204279 commit : ${{ github.sha }}
205280 release-build-google-play :
206281 name : Release Android build to the Google Play Store
207282 runs-on : ubuntu-latest
208283 needs : [build-android, build-macos, build-linux, build-windows]
284+ env :
285+ VERSION_NAME : ${{ needs.build-android.outputs.VERSION_NAME }}
209286 steps :
210287 - uses : actions/checkout@v3
211288 - name : Download Android artifacts
@@ -217,7 +294,7 @@ jobs:
217294 with :
218295 serviceAccountJsonPlainText : ${{ secrets.PLAYSTORE_ACCOUNT_KEY }}
219296 packageName : com.jgeek00.droid_hole
220- releaseFiles : DroidHole_${{ github.event.inputs.version }}_Android.aab
297+ releaseFiles : DroidHole_${{ env.VERSION_NAME }}_Android.aab
221298 track : production
222299 status : draft
223- releaseName : ${{ github.event.inputs.version }}
300+ releaseName : ${{ env.VERSION_NAME }}
0 commit comments