31
31
RELATIVE_PATH : " applications/external/subbrute"
32
32
CURRENT_VERSION : ${{ vars.RELEASE_VERSION }}
33
33
RELEASE_VERSION : ${{ vars.RELEASE_VERSION }}
34
+ APP_NAME : " "
34
35
ZIP_NAME : " "
35
36
ZIP_TAG : " "
36
37
TGZ_NAME : " "
@@ -55,16 +56,16 @@ jobs:
55
56
CURRENT_VERSION : ${{ env.CURRENT_VERSION }}
56
57
shell : pwsh
57
58
run : |
58
- $ReleaseVersion = ([string]::IsNullOrWhitespace($env:INPUT_VERSION) ? $env:CURRENT_VERSION : $env:INPUT_VERSION)
59
- if ( $ReleaseVersion .StartsWith('v') ) {
60
- $ReleaseVersion = $ReleaseVersion .Substring(1)
59
+ $releaseVersion = ([string]::IsNullOrWhitespace($env:INPUT_VERSION) ? $env:CURRENT_VERSION : $env:INPUT_VERSION)
60
+ if ( $releaseVersion .StartsWith('v') ) {
61
+ $releaseVersion = $releaseVersion .Substring(1)
61
62
}
62
- Write-Output ('RELEASE_VERSION={0}' -f $ReleaseVersion ) >> $env:GITHUB_ENV
63
+ Write-Output ('RELEASE_VERSION={0}' -f $releaseVersion ) >> $env:GITHUB_ENV
63
64
64
65
- name : Copy Firmware Files
65
66
uses : actions/checkout@v3
66
67
with :
67
- repository : " ${{ matrix.url }}"
68
+ repository : ${{ matrix.url }}
68
69
clean : " true"
69
70
submodules : " true"
70
71
ref : " dev"
73
74
if : ${{ matrix.src-included == 0 }}
74
75
uses : actions/checkout@v3
75
76
with :
76
- repository : " ${{ vars.REPO_SELF }}"
77
+ repository : ${{ vars.REPO_SELF }}
77
78
clean : " true"
78
79
submodules : " true"
79
80
path : " ${{ env.OFW_PATH }}"
@@ -97,13 +98,13 @@ jobs:
97
98
}
98
99
}
99
100
100
- $Output = (git log --pretty=format:'%s by %C(yellow)%an%Creset (%ad)%n %n%b' --date=local --abbrev-commit --max-count=1)
101
+ $output = (git log --pretty=format:'%s by %C(yellow)%an%Creset (%ad)%n %n%b' --date=local --abbrev-commit --max-count=1)
101
102
102
103
if ( $LASTEXITCODE -ne 0 ) {
103
104
Write-Error '::error title=Invalid checkout::Invalid checkout'
104
105
exit 1
105
106
}
106
- Write-Output ('::notice title=Git output::{0}' -f $Output )
107
+ Write-Output ('::notice title=Git output::{0}' -f $output )
107
108
108
109
- name : Print vars about state or repo if Official
109
110
if : ${{ matrix.src-included == 0 }}
@@ -122,13 +123,13 @@ jobs:
122
123
exit 1
123
124
}
124
125
} else {
125
- $Output = (git log --pretty=format:'%s by %C(yellow)%an%Creset (%ad)%n %n%b' --date=local --abbrev-commit --max-count=1)
126
+ $output = (git log --pretty=format:'%s by %C(yellow)%an%Creset (%ad)%n %n%b' --date=local --abbrev-commit --max-count=1)
126
127
127
128
if ( $LASTEXITCODE -ne 0 ) {
128
129
Write-Error '::error title=Invalid checkout::Invalid checkout'
129
130
exit 1
130
131
}
131
- Write-Output ('::notice title=Git output::{0}' -f $Output )
132
+ Write-Output ('::notice title=Git output::{0}' -f $output )
132
133
}
133
134
134
135
# - name: Restore FBT
@@ -149,11 +150,6 @@ jobs:
149
150
run : |
150
151
Remove-Item -Force -Recurse ./applications/debug -ErrorAction SilentlyContinue
151
152
Remove-Item -Force -Recurse ./applications/examples -ErrorAction SilentlyContinue
152
- # New-Item -Force ./tmp -ItemType Directory -ErrorAction SilentlyContinue
153
- # Copy-Item -Force -Recurse ./applications/external/subbrute/ ./tmp/ -ErrorAction SilentlyContinue
154
- # Remove-Item -Force -Recurse ./applications/external/* -ErrorAction SilentlyContinue
155
- # Copy-Item -Force -Recurse /tmp/* ./applications/external/ -ErrorAction SilentlyContinue
156
- # Remove-Item -Force -Recurse ./tmp -ErrorAction SilentlyContinue
157
153
158
154
- name : Build Firmware
159
155
shell : bash
@@ -191,8 +187,7 @@ jobs:
191
187
if : ${{ success() }}
192
188
shell : pwsh
193
189
env :
194
- ZIP_NAME : " subghz_bruteforcer_${{ env.RELEASE_VERSION }}_${{ matrix.firmware }}.zip"
195
- TGZ_NAME : " subghz_bruteforcer_${{ env.RELEASE_VERSION }}_${{ matrix.firmware }}.tgz"
190
+ APP_NAME : " subghz_bruteforcer_${{ env.RELEASE_VERSION }}_${{ matrix.firmware }}"
196
191
run : |
197
192
function Format-Bytes {
198
193
param(
@@ -205,52 +200,55 @@ jobs:
205
200
return "$number B"
206
201
}
207
202
else {
208
- $num = $number / [int64]"1$($sizes[$x-1])"
209
- $num = "{0:N2}" -f $num
210
- return "$num $($sizes[$x-1])"
203
+ $formattedNumber = $number / [int64]"1$($sizes[$x-1])"
204
+ $formattedNumber = "{0:N2}" -f $formattedNumber
205
+ return "$formattedNumber $($sizes[$x-1])"
211
206
}
212
207
}
213
208
}
214
209
}
215
- $ZipName = $env:ZIP_NAME
216
- $TgzName = $env:TGZ_NAME
217
- $FapNamme = 'subghz_bruteforcer.fap'
218
- $DstFap = "./$FapNamme "
219
- $AppDir = "dist/f7-C/apps/Sub-GHz"
210
+ $zipName = ('{0}.zip' -f $env:APP_NAME)
211
+ $tgzName = ('{0}.tgz' -f $env:APP_NAME)
212
+ $fapName = 'subghz_bruteforcer.fap'
213
+ $dstFap = "./$fapName "
214
+ $appDir = "dist/f7-C/apps/Sub-GHz"
220
215
221
- if (!(Test-Path -Path "$AppDir/$FapNamme " -PathType Leaf)) {
216
+ if (!(Test-Path -Path "$appDir/$fapName " -PathType Leaf)) {
222
217
Write-Error '::error title=Files not found::Cannot find files in location'
223
218
exit 1
224
219
}
225
220
226
- $Size = (Get-Item -Path "$AppDir/$FapNamme " | Get-ItemPropertyValue -Name Length)
227
- Write-Output ('Filesize: {0}' -f (Format-Bytes $Size ))
228
- Copy-Item -Force -Verbose -Path "$AppDir/$FapNamme " -Destination $DstFap
221
+ $size = (Get-Item -Path "$appDir/$fapName " | Get-ItemPropertyValue -Name Length)
222
+ Write-Output ('Filesize: {0}' -f (Format-Bytes $size ))
223
+ Copy-Item -Force -Verbose -Path "$appDir/$fapName " -Destination $dstFap
229
224
230
- zip -r -qq $ZipName $DstFap
231
- tar zcf $TgzName $DstFap
225
+ zip -r -qq $zipName $dstFap
226
+ tar zcf $tgzName $dstFap
232
227
233
- if ( !(Test-Path -Path $ZipName -PathType Leaf) -or !(Test-Path -Path $TgzName -PathType Leaf) ) {
228
+ if ( !(Test-Path -Path $zipName -PathType Leaf) -or !(Test-Path -Path $tgzName -PathType Leaf) ) {
234
229
Write-Error '::error title=Files not found::Cannot find files in location'
235
230
exit 1
236
231
}
237
232
238
- $ZipSize = Format-Bytes (Get-Item -Path $ZipName ).Length
239
- $TgzSize = Format-Bytes (Get-Item -Path $TgzName ).Length
233
+ $zipSize = Format-Bytes (Get-Item -Path $zipName ).Length
234
+ $tgzSize = Format-Bytes (Get-Item -Path $tgzName ).Length
240
235
241
- Write-Output ('ZIP_NAME={0}' -f $ZipName ) >> $env:GITHUB_ENV
242
- Write-Output ('TGZ_NAME={0}' -f $TgzName ) >> $env:GITHUB_ENV
243
- Write-Output ('ZIP_TAG={0} ({1})' -f $ZipName , $ZipSize ) >> $env:GITHUB_ENV
244
- Write-Output ('TGZ_TAG={0} ({1})' -f $TgzName , $TgzSize ) >> $env:GITHUB_ENV
236
+ Write-Output ('ZIP_NAME={0}' -f $zipName ) >> $env:GITHUB_ENV
237
+ Write-Output ('TGZ_NAME={0}' -f $tgzName ) >> $env:GITHUB_ENV
238
+ Write-Output ('ZIP_TAG={0} ({1})' -f $zipName , $zipSize ) >> $env:GITHUB_ENV
239
+ Write-Output ('TGZ_TAG={0} ({1})' -f $tgzName , $tgzSize ) >> $env:GITHUB_ENV
245
240
246
241
- name : Upload assets
247
242
if : ${{ success() && env.ZIP_NAME != '' }}
243
+ shell : pwsh
248
244
env :
249
245
GITHUB_TOKEN : ${{ secrets.FLIPPER_TOKEN }}
250
246
run : |
251
- gh release create v${{ env.RELEASE_VERSION }} --generate-notes --draft -R ${{ env.REPO_SELF }}
252
- gh release upload 'v${{ env.RELEASE_VERSION }}' '${{ env.ZIP_NAME }}#${{ env.ZIP_TAG }}' \
253
- '${{ env.TGZ_NAME }}#${{ env.TGZ_TAG }}' --clobber -R ${{ env.REPO_SELF }}
247
+ $url = (gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/${{ github.REPOSITORY }}/releases/tags/${{ env.RELEASE_VERSION }}) | ConvertFrom-Json -AsHashtable
248
+ if ( [string]::IsNullOrWhitespace($url) ) {
249
+ gh release create v${{ env.RELEASE_VERSION }} --generate-notes --draft -R ${{ env.REPO_SELF }}
250
+ }
251
+ gh release upload 'v${{ env.RELEASE_VERSION }}' '${{ env.ZIP_NAME }}#${{ env.ZIP_TAG }}' '${{ env.TGZ_NAME }}#${{ env.TGZ_TAG }}' --clobber -R ${{ env.REPO_SELF }}
254
252
gh release edit 'v${{ env.RELEASE_VERSION }}' --draft=false -R ${{ env.REPO_SELF }}
255
253
256
254
# EOF
0 commit comments