Skip to content

Commit

Permalink
ci 更新ci
Browse files Browse the repository at this point in the history
  • Loading branch information
chr233 committed Oct 7, 2024
1 parent 54876da commit f975e48
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 30 deletions.
43 changes: 14 additions & 29 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ on:
env:
PROJECT_NAME: "ASFEnhance"
REPO_NAME: "ASFEnhance"
TARGET_FILTER : "ASFEnhance.dll"
TARGET_FILTER: "ASFEnhance.dll"
DOTNET_SDK_VERSION: 8.0.x
LOCALES: "en-US ru-RU"

jobs:
build:
strategy:
fail-fast: false
matrix:
language: [zh-Hans, en-US, ru-RU]

runs-on: windows-latest

Expand All @@ -34,31 +33,29 @@ jobs:
- name: Verify .NET Core
run: dotnet --info

- name: Change language file to ${{ matrix.language }}
if: ${{ matrix.language != 'zh-Hans' }}
shell: pwsh
run: |
$projectName = "${{ env.PROJECT_NAME }}";
$language = "${{ matrix.language }}";
$localizationFolder = ".\$projectName\Localization";
Copy-Item -Path "$localizationFolder\Langs.$language.resx" -Destination "$localizationFolder\Langs.resx" -Force;
- 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 }} ${{ matrix.language }}
run: dotnet publish ${{ env.PROJECT_NAME }} -o ./tmp/ -c Release

- name: Zip files
run: 7z a -bd -slp -tzip -mm=Deflate -mx=5 -mfb=150 -mpass=10 "./dist/${{ env.PROJECT_NAME }}-${{ matrix.language }}.zip" "./tmp/${{ env.TARGET_FILTER }}"
shell: pwsh
run: |
$targetFiles = ""
$locales = "${{ env.LOCALES }}".Split(" ")
foreach ($locale in $locales) {
$targetFiles += " ./tmp/$locale/*"
}
7z a -bd -slp -tzip -mm=Deflate -mx=5 -mfb=150 -mpass=10 "./dist/${{ env.REPO_NAME }}.zip" "./tmp/${{ env.TARGET_FILTER }}" $targetFiles
- name: Upload ${{ env.PROJECT_NAME }} ${{ matrix.language }}
continue-on-error: true
uses: actions/[email protected]
with:
if-no-files-found: error
name: ${{ env.PROJECT_NAME }}-${{ matrix.language }}.zip
path: ./dist/${{ env.PROJECT_NAME }}-${{ matrix.language }}.zip
name: ${{ env.PROJECT_NAME }}.zip
path: ./dist/${{ env.PROJECT_NAME }}.zip

release:
needs: build
Expand All @@ -68,24 +65,12 @@ jobs:
- name: Checkout code
uses: actions/[email protected]

- name: Download ${{ env.PROJECT_NAME }}-zh-Hans artifact from windows-latest
uses: actions/[email protected]
with:
name: ${{ env.PROJECT_NAME }}-zh-Hans.zip
path: out

- name: Download ${{ env.PROJECT_NAME }}-en-US artifact from windows-latest
- name: Download ${{ env.PROJECT_NAME }} artifact from windows-latest
uses: actions/[email protected]
with:
name: ${{ env.PROJECT_NAME }}-en-US.zip
name: ${{ env.PROJECT_NAME }}.zip
path: out

- name: Download ${{ env.PROJECT_NAME }}-ru-RU artifact from windows-latest
uses: actions/[email protected]
with:
name: ${{ env.PROJECT_NAME }}-ru-RU.zip
path: out

- name: Create ${{ env.PROJECT_NAME }} GitHub release
uses: ncipollo/[email protected]
with:
Expand Down
7 changes: 6 additions & 1 deletion ASFEnhance/ASFEnhance.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@
</Using>
</ItemGroup>

<ItemGroup>
<ResourceDlls Include="bin\$(Configuration)\$(TargetFramework)\**\ASFEnhance.resources.dll" />
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Copy SourceFiles="$(TargetPath)" DestinationFolder="..\ArchiSteamFarm\ArchiSteamFarm\bin\$(Configuration)\$(TargetFramework)\plugins\" SkipUnchangedFiles="true" />
<Copy SourceFiles="@(ResourceDlls)" DestinationFiles="@(ResourceDlls->'..\ArchiSteamFarm\ArchiSteamFarm\bin\$(Configuration)\$(TargetFramework)\plugins\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
</Target>

</Project>

0 comments on commit f975e48

Please sign in to comment.