Skip to content

bugfix

bugfix #40

Workflow file for this run

name: publish
on:
push:
tags:
- "*"
env:
PROJECT_NAME: "ASFTradeExtension"
REPO_NAME: "ASFTradeExtension"
PLUGIN_NAME: "ASFTradeExtension.dll"
DOTNET_SDK_VERSION: 10.0
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v6.0.2
with:
submodules: recursive
- name: Setup .NET Core
uses: actions/setup-dotnet@v5.2.0
with:
dotnet-version: ${{ env.DOTNET_SDK_VERSION }}
- name: Verify .NET Core
run: dotnet --info
- name: Restore packages in preparation for ${{ env.PROJECT_NAME }} publishing
run: dotnet restore ${{ env.PROJECT_NAME }} -p:ContinuousIntegrationBuild=true --nologo
- name: Publish ${{ env.PROJECT_NAME }}
run: dotnet publish ${{ env.PROJECT_NAME }} -o:"./publish/" -c:Release
- name: Collect files
shell: pwsh
run: |
if (-Not (Test-Path -Path ./tmp)) {
New-Item -ItemType Directory -Path ./tmp
}
else {
Remove-Item -Path ./tmp/* -Recurse -Force
}
Copy-Item -Path .\publish\${{ env.PLUGIN_NAME }} -Destination .\tmp\
$dirs = Get-ChildItem -Path ./publish -Directory
foreach ($dir in $dirs) {
$subFiles = Get-ChildItem -Path $dir.FullName -File -Filter *.resources.dll
foreach ($file in $subFiles) {
$resourceName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
$opDir = "./tmp/$resourceName"
if (-Not (Test-Path -Path $opDir)) {
New-Item -ItemType Directory -Path $opDir
}
$destinationPath = ".\tmp\$resourceName\$($dir.Name).dll"
Copy-Item -Path $file -Destination $destinationPath
Write-Output "Copy resource DLL $($file.FullName) -> $destinationPath"
}
}
- name: Zip files
run: 7z a -bd -slp -tzip -mm=Deflate -mx=5 -mfb=150 -mpass=10 "./dist/${{ env.REPO_NAME }}.zip" "./tmp/*"
- name: Build ASF-Generic
shell: pwsh
run: |
$runtimes = "linux-x64", "win-x64", "win-arm64", "linux-arm64"
$config = "Release"
$projectName = "ArchiSteamFarm/ArchiSteamFarm"
dotnet restore $projectName
foreach ($runtime in $runtimes) {
Write-Debug "Publishing for runtime: $runtime"
$outputDir = "./tmp/ASF-$runtime"
dotnet publish $projectName --output $outputDir --self-contained --runtime $runtime --configuration $config --no-restore --nologo -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:ContinuousIntegrationBuild=true -p:UseAppHost=true
}
- name: Zip files
shell: pwsh
run: |
$root = "./tmp"
$dirList = Get-ChildItem -Path $root -Directory
$zipDist = "./dist"
foreach($dir in $dirList) {
$asfPath1 = Join-Path -Path $dir.FullName -ChildPath "ArchiSteamFarm"
$asfPath2 = Join-Path -Path $dir.FullName -ChildPath "ArchiSteamFarm.exe"
if (Test-Path -Path $asfPath1) {
$asfExe = $asfPath1
} elseif (Test-Path -Path $asfPath2) {
$asfExe = $asfPath2
} else {
continue
}
$zipName = "$zipDist/$($dir.Name).zip"
7z a -bd -slp -tzip -mm=Deflate -mx=5 -mfb=150 -mpass=10 "$zipName" "$asfExe"
}
- name: Display structure of upload files
shell: pwsh
run: Get-ChildItem -Path ./dist
- name: Upload ${{ env.PROJECT_NAME }}
continue-on-error: true
uses: actions/upload-artifact@v7.0.0
with:
if-no-files-found: error
path: ./dist/*.zip
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6.0.2
- name: Download ${{ env.PROJECT_NAME }} artifact from windows-latest
uses: actions/download-artifact@v8.0.1
with:
path: out
- name: Display structure of downloaded files
shell: pwsh
run: Get-ChildItem -Path ./out
- name: Create ${{ env.PROJECT_NAME }} GitHub release
uses: ncipollo/release-action@v1.21.0
with:
artifacts: "out/*"
makeLatest: false
prerelease: true
tag: ${{ github.ref_name }}
name: ${{ env.PROJECT_NAME }} ${{ github.ref_name }}
body: |
![Release](https://img.shields.io/badge/${{ env.REPO_NAME }}-${{ github.ref_name }}-brightgreen) ![Downloads](https://img.shields.io/github/downloads/chr233/${{ env.REPO_NAME }}/${{ github.ref_name }}/total?label=Downloads)
---
附带自编译版本的 ASF, 解压后覆盖原来的 ArchiSteamFarm 文件使用, 也可以使用 ASF-generic
---
release created bt github actions