3 on: [push, pull_request]
6 ASF_PRIVATE_SNK: ${{ secrets.ASF_PRIVATE_SNK }}
8 DOTNET_CLI_TELEMETRY_OPTOUT: true
10 DOTNET_SDK_VERSION: 6.0.x
11 NET_CORE_VERSION: net6.0
12 NET_FRAMEWORK_VERSION: net48
13 NODE_JS_VERSION: 'lts/*'
14 STEAM_TOKEN_DUMPER_NAME: ArchiSteamFarm.OfficialPlugins.SteamTokenDumper
15 STEAM_TOKEN_DUMPER_TOKEN: ${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }}
22 os: [macos-latest, ubuntu-latest, windows-2019]
24 runs-on: ${{ matrix.os }}
28 uses: actions/checkout@v3.0.0
32 - name: Setup .NET Core
33 uses: actions/setup-dotnet@v2.0.0
35 dotnet-version: ${{ env.DOTNET_SDK_VERSION }}
37 - name: Verify .NET Core
40 - name: Setup Node.js with npm
41 uses: actions/setup-node@v3.0.0
44 node-version: ${{ env.NODE_JS_VERSION }}
46 - name: Verify Node.js
52 - name: Install npm modules for ASF-ui
53 run: npm ci --no-progress --prefix ASF-ui
55 - name: Publish ASF-ui
56 run: npm run-script deploy --no-progress --prefix ASF-ui
58 - name: Prepare private key for signing on Unix
59 if: startsWith(matrix.os, 'macos-') || startsWith(matrix.os, 'ubuntu-')
64 if [ -n "${ASF_PRIVATE_SNK-}" ]; then
65 echo "$ASF_PRIVATE_SNK" | base64 -d > "resources/ArchiSteamFarm.snk"
68 - name: Prepare private key for signing on Windows
69 if: startsWith(matrix.os, 'windows-')
72 Set-StrictMode -Version Latest
73 $ErrorActionPreference = 'Stop'
74 $ProgressPreference = 'SilentlyContinue'
76 if ((Test-Path env:ASF_PRIVATE_SNK) -and ($env:ASF_PRIVATE_SNK)) {
77 echo "$env:ASF_PRIVATE_SNK" > "resources\ArchiSteamFarm.snk"
79 certutil -f -decode "resources\ArchiSteamFarm.snk" "resources\ArchiSteamFarm.snk"
81 if ($LastExitCode -ne 0) {
82 throw "Last command failed."
86 - name: Prepare ArchiSteamFarm.OfficialPlugins.SteamTokenDumper on Unix
87 if: startsWith(matrix.os, 'macos-') || startsWith(matrix.os, 'ubuntu-')
92 if [ -n "${STEAM_TOKEN_DUMPER_TOKEN-}" ] && [ -f "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs" ]; then
93 sed "s/STEAM_TOKEN_DUMPER_TOKEN/${STEAM_TOKEN_DUMPER_TOKEN}/g" "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs" > "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs.new"
94 mv "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs.new" "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs"
97 - name: Prepare ArchiSteamFarm.OfficialPlugins.SteamTokenDumper on Windows
98 if: startsWith(matrix.os, 'windows-')
101 Set-StrictMode -Version Latest
102 $ErrorActionPreference = 'Stop'
103 $ProgressPreference = 'SilentlyContinue'
105 if ((Test-Path env:STEAM_TOKEN_DUMPER_TOKEN) -and ($env:STEAM_TOKEN_DUMPER_TOKEN) -and (Test-Path "$env:STEAM_TOKEN_DUMPER_NAME\SharedInfo.cs" -PathType Leaf)) {
106 (Get-Content "$env:STEAM_TOKEN_DUMPER_NAME\SharedInfo.cs").Replace('STEAM_TOKEN_DUMPER_TOKEN', "$env:STEAM_TOKEN_DUMPER_TOKEN") | Set-Content "$env:STEAM_TOKEN_DUMPER_NAME\SharedInfo.cs"
109 - name: Publish ArchiSteamFarm.OfficialPlugins.SteamTokenDumper for .NET Core
110 run: dotnet publish "${{ env.STEAM_TOKEN_DUMPER_NAME }}" -c "${{ env.CONFIGURATION }}" -f "${{ env.NET_CORE_VERSION }}" -o "out/${{ env.STEAM_TOKEN_DUMPER_NAME }}/${{ env.NET_CORE_VERSION }}" -p:ContinuousIntegrationBuild=true -p:TargetLatestRuntimePatch=false -p:UseAppHost=false --nologo
112 - name: Publish ArchiSteamFarm.OfficialPlugins.SteamTokenDumper for .NET Framework
113 if: startsWith(matrix.os, 'windows-')
114 run: dotnet publish "${{ env.STEAM_TOKEN_DUMPER_NAME }}" -c "${{ env.CONFIGURATION }}" -f "${{ env.NET_FRAMEWORK_VERSION }}" -o "out/${{ env.STEAM_TOKEN_DUMPER_NAME }}/${{ env.NET_FRAMEWORK_VERSION }}" -p:ContinuousIntegrationBuild=true -p:TargetLatestRuntimePatch=false -p:UseAppHost=false --nologo
116 - name: Restore packages in preparation for ArchiSteamFarm publishing
117 run: dotnet restore ArchiSteamFarm -p:ContinuousIntegrationBuild=true --nologo
119 - name: Publish ArchiSteamFarm on Unix
120 if: startsWith(matrix.os, 'macos-') || startsWith(matrix.os, 'ubuntu-')
122 VARIANTS: generic linux-arm linux-arm64 linux-x64 osx-arm64 osx-x64 win-x64 # NOTE: When modifying variants, don't forget to update ASF_VARIANT definitions in SharedInfo.cs!
128 if [ "$1" = 'generic' ]; then
129 variantArgs="-p:TargetLatestRuntimePatch=false -p:UseAppHost=false"
131 variantArgs="-p:PublishSingleFile=true -p:PublishTrimmed=true -r $1 --self-contained"
134 dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${1}" "-p:ASFVariant=$1" -p:ContinuousIntegrationBuild=true --no-restore --nologo $variantArgs
136 # If we're including any overlay for this variant, copy it to output directory
137 variant_os="$(echo "$1" | cut -d '-' -f 1)"
139 if [ -d "ArchiSteamFarm/overlay/${variant_os}" ]; then
140 cp -pR "ArchiSteamFarm/overlay/${variant_os}/"* "out/${1}"
143 if [ "$1" != "$variant_os" ] && [ -d "ArchiSteamFarm/overlay/${1}" ]; then
144 cp -pR "ArchiSteamFarm/overlay/${1}/"* "out/${1}"
147 # If we're including SteamTokenDumper plugin for this framework, copy it to output directory
148 if [ -d "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}" ]; then
149 mkdir -p "out/${1}/plugins/${STEAM_TOKEN_DUMPER_NAME}"
150 cp -pR "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}/"* "out/${1}/plugins/${STEAM_TOKEN_DUMPER_NAME}"
153 # Include .ico file for all platforms, since only Windows script can bundle it inside the exe
154 cp "resources/ASF.ico" "out/${1}/ArchiSteamFarm.ico"
156 # By default use fastest compression
157 seven_zip_args="-mx=1"
160 # Include extra logic for builds marked for release
161 case "$GITHUB_REF" in
163 # Tweak compression args for release publishing
164 seven_zip_args="-mx=9 -mfb=258 -mpass=15"
167 # Update link in Changelog.html accordingly
168 if [ -f "out/${1}/Changelog.html" ]; then
169 tag="$(echo "$GITHUB_REF" | cut -c 11-)"
171 sed "s/ArchiSteamFarm\/commits\/main/ArchiSteamFarm\/releases\/tag\/${tag}/g" "out/${1}/Changelog.html" > "out/${1}/Changelog.html.new"
172 mv "out/${1}/Changelog.html.new" "out/${1}/Changelog.html"
177 # Create the final zip file
178 case "$(uname -s)" in
180 # We prefer to use zip on OS X as 7z implementation on that OS doesn't handle file permissions (chmod +x)
181 if command -v zip >/dev/null; then
183 cd "${GITHUB_WORKSPACE}/out/${1}"
184 zip -q -r $zip_args "../ASF-${1}.zip" .
186 elif command -v 7z >/dev/null; then
187 7z a -bd -slp -tzip -mm=Deflate $seven_zip_args "out/ASF-${1}.zip" "${GITHUB_WORKSPACE}/out/${1}/*"
189 echo "ERROR: No supported zip tool!"
194 if command -v 7z >/dev/null; then
195 7z a -bd -slp -tzip -mm=Deflate $seven_zip_args "out/ASF-${1}.zip" "${GITHUB_WORKSPACE}/out/${1}/*"
196 elif command -v zip >/dev/null; then
198 cd "${GITHUB_WORKSPACE}/out/${1}"
199 zip -q -r $zip_args "../ASF-${1}.zip" .
202 echo "ERROR: No supported zip tool!"
211 for variant in $VARIANTS; do
220 - name: Publish ArchiSteamFarm on Windows
221 if: startsWith(matrix.os, 'windows-')
223 VARIANTS: generic generic-netf linux-arm linux-arm64 linux-x64 osx-arm64 osx-x64 win-x64 # NOTE: When modifying variants, don't forget to update ASF_VARIANT definitions in SharedInfo.cs!
226 Set-StrictMode -Version Latest
227 $ErrorActionPreference = 'Stop'
228 $ProgressPreference = 'SilentlyContinue'
233 Set-StrictMode -Version Latest
234 $ErrorActionPreference = 'Stop'
235 $ProgressPreference = 'SilentlyContinue'
237 Set-Location "$env:GITHUB_WORKSPACE"
239 if ($variant -like '*-netf') {
240 $targetFramework = $env:NET_FRAMEWORK_VERSION
242 $targetFramework = $env:NET_CORE_VERSION
245 if ($variant -like 'generic*') {
246 $variantArgs = '-p:TargetLatestRuntimePatch=false', '-p:UseAppHost=false'
248 $variantArgs = '-p:PublishSingleFile=true', '-p:PublishTrimmed=true', '-r', "$variant", '--self-contained'
251 dotnet publish ArchiSteamFarm -c "$env:CONFIGURATION" -f "$targetFramework" -o "out\$variant" "-p:ASFVariant=$variant" -p:ContinuousIntegrationBuild=true --no-restore --nologo $variantArgs
253 if ($LastExitCode -ne 0) {
254 throw "Last command failed."
257 # If we're including any overlay for this variant, copy it to output directory
258 $variant_os = $variant.Split('-', 2)[0];
260 if (Test-Path "ArchiSteamFarm\overlay\$variant_os" -PathType Container) {
261 Copy-Item "ArchiSteamFarm\overlay\$variant_os\*" "out\$variant" -Recurse
264 if (($variant -ne $variant_os) -and (Test-Path "ArchiSteamFarm\overlay\$variant" -PathType Container)) {
265 Copy-Item "ArchiSteamFarm\overlay\$variant\*" "out\$variant" -Recurse
268 # If we're including SteamTokenDumper plugin for this framework, copy it to output directory
269 if (Test-Path "out\$env:STEAM_TOKEN_DUMPER_NAME\$targetFramework" -PathType Container) {
270 if (!(Test-Path "out\$variant\plugins\$env:STEAM_TOKEN_DUMPER_NAME" -PathType Container)) {
271 New-Item -ItemType Directory -Path "out\$variant\plugins\$env:STEAM_TOKEN_DUMPER_NAME" > $null
274 Copy-Item "out\$env:STEAM_TOKEN_DUMPER_NAME\$targetFramework\*" "out\$variant\plugins\$env:STEAM_TOKEN_DUMPER_NAME" -Recurse
277 # Icon is available only in .NET Framework and .NET Core Windows build, we'll bundle the .ico file for other flavours
278 if (($targetFramework -eq "$env:NET_CORE_VERSION") -and !(Test-Path "out\$variant\ArchiSteamFarm.exe" -PathType Leaf)) {
279 Copy-Item 'resources\ASF.ico' "out\$variant\ArchiSteamFarm.ico"
282 # By default use fastest compression
283 $compressionArgs = '-mx=1'
285 # Include extra logic for builds marked for release
286 if ($env:GITHUB_REF -like 'refs/tags/*') {
287 # Tweak compression args for release publishing
288 $compressionArgs = '-mx=9', '-mfb=258', '-mpass=15'
290 # Update link in Changelog.html accordingly
291 if (Test-Path "out\$variant\Changelog.html" -PathType Leaf) {
292 $tag = $env:GITHUB_REF.Substring(10)
294 (Get-Content "out\$variant\Changelog.html").Replace('ArchiSteamFarm/commits/main', "ArchiSteamFarm/releases/tag/$tag") | Set-Content "out\$variant\Changelog.html"
298 # Create the final zip file
299 7z a -bd -slp -tzip -mm=Deflate $compressionArgs "out\ASF-$variant.zip" "$env:GITHUB_WORKSPACE\out\$variant\*"
301 if ($LastExitCode -ne 0) {
302 throw "Last command failed."
305 # We can aid non-windows users by adding chmod +x flag to appropriate executables directly in the zip file
306 # This is ALMOST a hack, but works reliably enough
307 if (Test-Path "tools\zip_exec\zip_exec.exe" -PathType Leaf) {
308 $executableFiles = @()
310 if ($variant -like 'generic*') {
311 $executableFiles += 'ArchiSteamFarm.sh', 'ArchiSteamFarm-Service.sh'
312 } elseif (($variant -like 'linux*') -or ($variant -like 'osx*')) {
313 $executableFiles += 'ArchiSteamFarm', 'ArchiSteamFarm-Service.sh'
316 foreach ($executableFile in $executableFiles) {
317 tools\zip_exec\zip_exec.exe "out\ASF-$variant.zip" "$executableFile"
319 if ($LastExitCode -ne 0) {
320 throw "Last command failed."
326 foreach ($variant in $env:VARIANTS.Split([char[]] $null, [System.StringSplitOptions]::RemoveEmptyEntries)) {
327 Start-Job -Name "$variant" $PublishBlock -ArgumentList "$variant"
329 # Limit active jobs in parallel to help with memory usage
330 $jobs = $(Get-Job -State Running)
332 while (@($jobs).Count -ge 5) {
333 Wait-Job -Job $jobs -Any | Out-Null
335 $jobs = $(Get-Job -State Running)
339 Get-Job | Receive-Job -Wait
341 - name: Upload ASF-generic
342 continue-on-error: true
343 uses: actions/upload-artifact@v3.0.0
345 name: ${{ matrix.os }}_ASF-generic
346 path: out/ASF-generic.zip
348 - name: Upload ASF-generic-netf
349 continue-on-error: true
350 if: startsWith(matrix.os, 'windows-')
351 uses: actions/upload-artifact@v3.0.0
353 name: ${{ matrix.os }}_ASF-generic-netf
354 path: out/ASF-generic-netf.zip
356 - name: Upload ASF-linux-arm
357 continue-on-error: true
358 uses: actions/upload-artifact@v3.0.0
360 name: ${{ matrix.os }}_ASF-linux-arm
361 path: out/ASF-linux-arm.zip
363 - name: Upload ASF-linux-arm64
364 continue-on-error: true
365 uses: actions/upload-artifact@v3.0.0
367 name: ${{ matrix.os }}_ASF-linux-arm64
368 path: out/ASF-linux-arm64.zip
370 - name: Upload ASF-linux-x64
371 continue-on-error: true
372 uses: actions/upload-artifact@v3.0.0
374 name: ${{ matrix.os }}_ASF-linux-x64
375 path: out/ASF-linux-x64.zip
377 - name: Upload ASF-osx-arm64
378 continue-on-error: true
379 uses: actions/upload-artifact@v3.0.0
381 name: ${{ matrix.os }}_ASF-osx-arm64
382 path: out/ASF-osx-arm64.zip
384 - name: Upload ASF-osx-x64
385 continue-on-error: true
386 uses: actions/upload-artifact@v3.0.0
388 name: ${{ matrix.os }}_ASF-osx-x64
389 path: out/ASF-osx-x64.zip
391 - name: Upload ASF-win-x64
392 continue-on-error: true
393 uses: actions/upload-artifact@v3.0.0
395 name: ${{ matrix.os }}_ASF-win-x64
396 path: out/ASF-win-x64.zip
399 if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
401 runs-on: ubuntu-latest
404 - name: Checkout code
405 uses: actions/checkout@v3.0.0
407 # TODO: It'd be perfect if we could match final artifacts to the platform they target, so e.g. linux build comes from the linux machine
408 # However, that is currently impossible due to https://github.com/dotnet/msbuild/issues/3897
409 # Therefore, we'll (sadly) pull artifacts from Windows machine only for now
410 - name: Download ASF-generic artifact from windows-2019
411 uses: actions/download-artifact@v3.0.0
413 name: windows-2019_ASF-generic
416 - name: Download ASF-generic-netf artifact from windows-2019
417 uses: actions/download-artifact@v3.0.0
419 name: windows-2019_ASF-generic-netf
422 - name: Download ASF-linux-arm artifact from windows-2019
423 uses: actions/download-artifact@v3.0.0
425 name: windows-2019_ASF-linux-arm
428 - name: Download ASF-linux-arm64 artifact from windows-2019
429 uses: actions/download-artifact@v3.0.0
431 name: windows-2019_ASF-linux-arm64
434 - name: Download ASF-linux-x64 artifact from windows-2019
435 uses: actions/download-artifact@v3.0.0
437 name: windows-2019_ASF-linux-x64
440 - name: Download ASF-osx-arm64 artifact from windows-2019
441 uses: actions/download-artifact@v3.0.0
443 name: windows-2019_ASF-osx-arm64
446 - name: Download ASF-osx-x64 artifact from windows-2019
447 uses: actions/download-artifact@v3.0.0
449 name: windows-2019_ASF-osx-x64
452 - name: Download ASF-win-x64 artifact from windows-2019
453 uses: actions/download-artifact@v3.0.0
455 name: windows-2019_ASF-win-x64
458 - name: Import GPG key for signing
459 uses: crazy-max/ghaction-import-gpg@v4.2.0
461 gpg_private_key: ${{ secrets.ARCHIBOT_GPG_PRIVATE_KEY }}
463 - name: Generate SHA-512 checksums and signature
471 sha512sum *.zip > SHA512SUMS
472 gpg -a -b -o SHA512SUMS.sign SHA512SUMS
475 - name: Upload SHA512SUMS
476 continue-on-error: true
477 uses: actions/upload-artifact@v3.0.0
482 - name: Upload SHA512SUMS.sign
483 continue-on-error: true
484 uses: actions/upload-artifact@v3.0.0
486 name: SHA512SUMS.sign
487 path: out/SHA512SUMS.sign
489 - name: Create ArchiSteamFarm GitHub release
491 uses: actions/create-release@v1.1.4
493 GITHUB_TOKEN: ${{ secrets.ARCHIBOT_GITHUB_TOKEN }}
495 tag_name: ${{ github.ref }}
496 release_name: ArchiSteamFarm V${{ github.ref }}
497 body_path: .github/RELEASE_TEMPLATE.md
500 - name: Upload ASF-generic to GitHub release
501 uses: actions/upload-release-asset@v1.0.2
503 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
505 upload_url: ${{ steps.github_release.outputs.upload_url }}
506 asset_path: out/ASF-generic.zip
507 asset_name: ASF-generic.zip
508 asset_content_type: application/zip
510 - name: Upload ASF-generic-netf to GitHub release
511 uses: actions/upload-release-asset@v1.0.2
513 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
515 upload_url: ${{ steps.github_release.outputs.upload_url }}
516 asset_path: out/ASF-generic-netf.zip
517 asset_name: ASF-generic-netf.zip
518 asset_content_type: application/zip
520 - name: Upload ASF-linux-arm to GitHub release
521 uses: actions/upload-release-asset@v1.0.2
523 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
525 upload_url: ${{ steps.github_release.outputs.upload_url }}
526 asset_path: out/ASF-linux-arm.zip
527 asset_name: ASF-linux-arm.zip
528 asset_content_type: application/zip
530 - name: Upload ASF-linux-arm64 to GitHub release
531 uses: actions/upload-release-asset@v1.0.2
533 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
535 upload_url: ${{ steps.github_release.outputs.upload_url }}
536 asset_path: out/ASF-linux-arm64.zip
537 asset_name: ASF-linux-arm64.zip
538 asset_content_type: application/zip
540 - name: Upload ASF-linux-x64 to GitHub release
541 uses: actions/upload-release-asset@v1.0.2
543 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
545 upload_url: ${{ steps.github_release.outputs.upload_url }}
546 asset_path: out/ASF-linux-x64.zip
547 asset_name: ASF-linux-x64.zip
548 asset_content_type: application/zip
550 - name: Upload ASF-osx-arm64 to GitHub release
551 uses: actions/upload-release-asset@v1.0.2
553 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
555 upload_url: ${{ steps.github_release.outputs.upload_url }}
556 asset_path: out/ASF-osx-arm64.zip
557 asset_name: ASF-osx-arm64.zip
558 asset_content_type: application/zip
560 - name: Upload ASF-osx-x64 to GitHub release
561 uses: actions/upload-release-asset@v1.0.2
563 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
565 upload_url: ${{ steps.github_release.outputs.upload_url }}
566 asset_path: out/ASF-osx-x64.zip
567 asset_name: ASF-osx-x64.zip
568 asset_content_type: application/zip
570 - name: Upload ASF-win-x64 to GitHub release
571 uses: actions/upload-release-asset@v1.0.2
573 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
575 upload_url: ${{ steps.github_release.outputs.upload_url }}
576 asset_path: out/ASF-win-x64.zip
577 asset_name: ASF-win-x64.zip
578 asset_content_type: application/zip
580 - name: Upload SHA512SUMS to GitHub release
581 uses: actions/upload-release-asset@v1.0.2
583 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
585 upload_url: ${{ steps.github_release.outputs.upload_url }}
586 asset_path: out/SHA512SUMS
587 asset_name: SHA512SUMS
588 asset_content_type: text/plain
590 - name: Upload SHA512SUMS.sign to GitHub release
591 uses: actions/upload-release-asset@v1.0.2
593 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
595 upload_url: ${{ steps.github_release.outputs.upload_url }}
596 asset_path: out/SHA512SUMS.sign
597 asset_name: SHA512SUMS.sign
598 asset_content_type: text/plain