Skip to content

Commit ff8b89f

Browse files
authored
Merge pull request #26 from DarkFlippers/feat/ci
Feat/ci
2 parents d024183 + 355a608 commit ff8b89f

File tree

1 file changed

+42
-11
lines changed

1 file changed

+42
-11
lines changed

.github/workflows/build-with-firmwware.yml

+42-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
required: false
1010
type: string
1111
release:
12-
types: [created]
12+
types: [created,prereleased]
1313
push:
1414
paths:
1515
- .github/workflows/build-with-firmware.yml
@@ -31,6 +31,10 @@ jobs:
3131
RELATIVE_PATH: "applications/external/subbrute"
3232
CURRENT_VERSION: ${{ vars.RELEASE_VERSION }}
3333
RELEASE_VERSION: ${{ vars.RELEASE_VERSION }}
34+
ZIP_NAME: ''
35+
ZIP_TAG: ''
36+
TGZ_NAME: ''
37+
TGZ_TAG: ''
3438
strategy:
3539
fail-fast: false
3640
matrix:
@@ -53,7 +57,7 @@ jobs:
5357
$ReleaseVersion = ([string]::IsNullOrWhitespace($env:INPUT_VERSION) ? $env:CURRENT_VERSION : $env:INPUT_VERSION)
5458
Write-Output ('RELEASE_VERSION={0}' -f $ReleaseVersion) >> $env:GITHUB_ENV
5559
56-
- name: Copy Repo Files
60+
- name: Copy Firmware Files
5761
uses: actions/checkout@v3
5862
with:
5963
repository: "${{ matrix.url }}"
@@ -132,6 +136,19 @@ jobs:
132136
# # An explicit key for restoring and saving the cache
133137
# key: 'fbt=${{ env.FIRMWARE_VERSION }}'
134138
#
139+
- name: Remove other apps
140+
shell: bash
141+
if: ${{ success() }}
142+
# rm to remove problem FAP which includes non existent files
143+
run: |
144+
rm -Rf ./applications/debug ./applications/examples
145+
mkdir ./tmp
146+
mv ./applications/external/application.fam ./tmp/
147+
mv -f ./applications/external/subbrute/ ./tmp/
148+
rm -Rf ./applications/external/*
149+
mv -f ./tmp/* ./applications/external/
150+
rm -Rf ./tmp/
151+
135152
- name: Build Firmware
136153
shell: bash
137154
if: ${{ success() }}
@@ -140,7 +157,18 @@ jobs:
140157
DIST_SUFFIX: ${{ matrix.version }}
141158
WORKFLOW_BRANCH_OR_TAG: release-cfw
142159
run: |
143-
./fbt COMPACT=1 DEBUG=0 fap_dist
160+
./fbt COMPACT=1 DEBUG=0 FBT_NO_SYNC=0
161+
162+
- name: Build FAPs
163+
shell: bash
164+
if: ${{ success() }}
165+
env:
166+
FBT_NO_SYNC: 0
167+
DIST_SUFFIX: ${{ matrix.version }}
168+
WORKFLOW_BRANCH_OR_TAG: release-cfw
169+
# rm to remove problem FAP which includes non existent files
170+
run: |
171+
./fbt COMPACT=1 DEBUG=0 FBT_NO_SYNC=0 fap_dist
144172
145173
# - name: Save FBT
146174
# id: cache-save
@@ -180,20 +208,21 @@ jobs:
180208
}
181209
$ZipName = $env:ZIP_NAME
182210
$TgzName = $env:TGZ_NAME
183-
$FapNamme = 'SubGHz_Bruteforcer.fap'
211+
$FapNamme = 'subghz_bruteforcer.fap'
184212
$DstFap = "./$FapNamme"
213+
$AppDir = "dist/f7-C/apps/Sub-GHz"
185214
186-
if (!(Test-Path -Path "dist/f7-C/apps/Sub-GHz/$FapNamme" -PathType Leaf)) {
215+
if (!(Test-Path -Path "$AppDir/$FapNamme" -PathType Leaf)) {
187216
Write-Error '::error title=Files not found::Cannot find files in location'
188217
exit 1
189218
}
190219
191-
$Size = (Get-Item -Path "dist/f7-C/apps/Sub-GHz/$FapNamme" | Get-ItemPropertyValue -Name Length)
220+
$Size = (Get-Item -Path "$AppDir/$FapNamme" | Get-ItemPropertyValue -Name Length)
192221
Write-Output ('Filesize: {0}' -f (Format-Bytes $Size))
193-
Copy-Item -Force -Path "dist/f7-C/apps/Sub-GHz/$FapNamme" -Destination $DstFap
222+
Copy-Item -Force -Verbose -Path "$AppDir/$FapNamme" -Destination $DstFap
194223
195224
zip -r -qq $ZipName $DstFap
196-
tar zcf $TgzName $DstFap
225+
tar zcf $TgzName $DstFap
197226
198227
if ( !(Test-Path -Path $ZipName -PathType Leaf) -or !(Test-Path -Path $TgzName -PathType Leaf) ) {
199228
Write-Error '::error title=Files not found::Cannot find files in location'
@@ -207,13 +236,15 @@ jobs:
207236
Write-Output ('TGZ_NAME={0}' -f $TgzName ) >> $env:GITHUB_ENV
208237
Write-Output ('ZIP_TAG={0} ({1})' -f $ZipName, $ZipSize) >> $env:GITHUB_ENV
209238
Write-Output ('TGZ_TAG={0} ({1})' -f $TgzName , $TgzSize) >> $env:GITHUB_ENV
210-
- name: Create assets
239+
240+
- name: Upload assets
211241
if: ${{ success() && env.ZIP_NAME != '' }}
212242
env:
213243
GITHUB_TOKEN: ${{ secrets.FLIPPER_TOKEN }}
214244
run: |
215-
gh release upload 'v${{ env.RELEASE_VERSION }}' --clobber \
216-
'${{ env.ZIP_NAME }}#${{ env.ZIP_TAG }}' '${{ env.TGZ_NAME }}#${{ env.TGZ_TAG }}' -R ${{ env.REPO_SELF }}
245+
gh release create v${{ env.RELEASE_VERSION }} --generate-notes --draft -R ${{ env.REPO_SELF }}
246+
gh release upload 'v${{ env.RELEASE_VERSION }}' '${{ env.ZIP_NAME }}#${{ env.ZIP_TAG }}' \
247+
'${{ env.TGZ_NAME }}#${{ env.TGZ_TAG }}' --clobber -R ${{ env.REPO_SELF }}
217248
gh release edit 'v${{ env.RELEASE_VERSION }}' --draft=false -R ${{ env.REPO_SELF }}
218249
219250
#EOF

0 commit comments

Comments
 (0)