-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add single file portable build + autocreation of release after tagging
Single file portable build: - No .Net installation necessary, but big file and slow execution Auto creation of release after tagging: - Workflow is triggered after a tag is created. Release is in state prereleased and includes all files from the github action workflow and are scanned by virus total
- Loading branch information
Showing
15 changed files
with
299 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,10 @@ name: AntiDupl CI Build | |
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
branches: | ||
- master | ||
tags: | ||
- v* | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
|
@@ -12,10 +15,10 @@ env: | |
jobs: | ||
|
||
build: | ||
|
||
strategy: | ||
matrix: | ||
configuration: [Debug, Release] | ||
configuration: [Debug, Release, Publish] | ||
|
||
runs-on: windows-latest | ||
|
||
|
@@ -25,7 +28,13 @@ jobs: | |
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
|
||
- name: Read version.txt | ||
id: version | ||
uses: juliangruber/read-file-action@v1 | ||
with: | ||
path: ./src/version.txt | ||
|
||
- name: Setup MSBuild.exe | ||
uses: microsoft/[email protected] | ||
|
||
|
@@ -46,44 +55,120 @@ jobs: | |
run: | | ||
${{ github.workspace }}/vcpkg/vcpkg.exe integrate install | ||
- name: Build | ||
- if: matrix.configuration == 'Release' || matrix.configuration == 'Debug' | ||
name: Build | ||
working-directory: ${{env.GITHUB_WORKSPACE}} | ||
run: msbuild /m /p:Configuration=$env:Configuration $env:Solution_Name | ||
env: | ||
Configuration: ${{ matrix.configuration }} | ||
|
||
- name: Make release binary and source files | ||
|
||
- if: matrix.configuration == 'Publish' | ||
name: Build | ||
working-directory: ${{env.GITHUB_WORKSPACE}} | ||
run: msbuild /m $env:Solution_Name /p:Configuration=$env:Configuration -restore -t:Publish -p:PublishProfile="AntiDuplPublishSingleFile" | ||
env: | ||
Configuration: ${{ matrix.configuration }} | ||
|
||
- if: matrix.configuration == 'Release' | ||
name: Make release binary and source files | ||
working-directory: ${{env.GITHUB_WORKSPACE}} | ||
run: | | ||
cd cmd | ||
.\MakeBin.cmd | ||
.\MakeSrc.cmd | ||
- name: VirusTotal Scan | ||
uses: crazy-max/ghaction-virustotal@v3 | ||
env: | ||
VT_API_KEY: ${{ secrets.VT_API_KEY }} | ||
if: matrix.configuration == 'Release' && env.VT_API_KEY != null | ||
with: | ||
vt_api_key: ${{ secrets.VT_API_KEY }} | ||
files: | | ||
${{ github.workspace }}\bin\Release\AntiDupl.NET.WinForms.exe | ||
- if: matrix.configuration == 'Publish' | ||
name: Make release binary and source files | ||
working-directory: ${{env.GITHUB_WORKSPACE}} | ||
run: | | ||
cd cmd | ||
.\MakePublish.cmd | ||
- if: matrix.configuration == 'Release' | ||
name: Upload build | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: AntiDupl.NET-2.3.11 build | ||
name: "AntiDupl.NET-${{ steps.version.outputs.content }} build" | ||
path: | | ||
${{ github.workspace }}\out\bin\AntiDupl.NET-2.3.11.exe | ||
${{ github.workspace }}\out\bin\AntiDupl.NET-2.3.11.exe.hash.txt | ||
${{ github.workspace }}\out\bin\AntiDupl.NET-2.3.11.7z | ||
${{ github.workspace }}\out\bin\AntiDupl.NET-2.3.11.7z.hash.txt | ||
- name: Upload source | ||
${{ github.workspace }}\out\bin\AntiDupl.NET-${{ steps.version.outputs.content }}.exe | ||
${{ github.workspace }}\out\bin\AntiDupl.NET-${{ steps.version.outputs.content }}.exe.hash.txt | ||
${{ github.workspace }}\out\bin\AntiDupl.NET-${{ steps.version.outputs.content }}.zip | ||
${{ github.workspace }}\out\bin\AntiDupl.NET-${{ steps.version.outputs.content }}.zip.hash.txt | ||
- if: matrix.configuration == 'Publish' | ||
name: Upload build SingleFilePortable | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: AntiDupl.NET-2.3.11 sources | ||
name: "AntiDupl.NET-${{ steps.version.outputs.content }} build SingleFilePortable" | ||
path: | | ||
${{ github.workspace }}\out\src\AntiDupl.NET-2.3.11_Sources.7z | ||
${{ github.workspace }}\out\src\AntiDupl.NET-2.3.11_Sources.7z.hash.txt | ||
${{ github.workspace }}\out\Publish\AntiDupl.NET-${{ steps.version.outputs.content }}_SingleFilePortable.exe | ||
${{ github.workspace }}\out\Publish\AntiDupl.NET-${{ steps.version.outputs.content }}_SingleFilePortable.exe.hash.txt | ||
${{ github.workspace }}\out\Publish\AntiDupl.NET-${{ steps.version.outputs.content }}_SingleFilePortable.zip | ||
${{ github.workspace }}\out\Publish\AntiDupl.NET-${{ steps.version.outputs.content }}_SingleFilePortable.zip.hash.txt | ||
create-draft-release: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: build | ||
|
||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: msys2/setup-msys2@v2 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Read version.txt | ||
id: version | ||
uses: juliangruber/read-file-action@v1 | ||
with: | ||
path: ./src/version.txt | ||
|
||
- name: Load all artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: "AntiDupl.NET-${{ steps.version.outputs.content }} build" | ||
|
||
- name: Load all artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: "AntiDupl.NET-${{ steps.version.outputs.content }} build SingleFilePortable" | ||
|
||
- name: Virus Total Scan | ||
id: scan_files | ||
uses: crazy-max/ghaction-virustotal@v3 | ||
with: | ||
vt_api_key: ${{ secrets.VT_API_KEY }} | ||
files: | | ||
AntiDupl.NET-${{ steps.version.outputs.content }}.exe | ||
AntiDupl.NET-${{ steps.version.outputs.content }}.zip | ||
AntiDupl.NET-${{ steps.version.outputs.content }}_SingleFilePortable.exe | ||
AntiDupl.NET-${{ steps.version.outputs.content }}_SingleFilePortable.zip | ||
- name: Generate VirusTotal Body | ||
shell: msys2 {0} | ||
run: | | ||
echo "🛡 [VirusTotal GitHub Action](https://github.com/crazy-max/ghaction-virustotal) analysis:" >> body.txt | ||
echo "" >> body.txt | ||
analysis="${{ steps.scan_files.outputs.analysis }}" | ||
while read -d, -r pair; do | ||
IFS='=' read -r filename analysisURL <<<"$pair" | ||
echo "* [$(basename $filename)]($analysisURL)" >> body.txt | ||
done <<<"$analysis," | ||
- name: GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: "AntiDupl.NET v${{ steps.version.outputs.content }}" | ||
body_path: body.txt | ||
prerelease: true | ||
files: | | ||
AntiDupl.NET-${{ steps.version.outputs.content }}.exe | ||
AntiDupl.NET-${{ steps.version.outputs.content }}.exe.hash.txt | ||
AntiDupl.NET-${{ steps.version.outputs.content }}.zip | ||
AntiDupl.NET-${{ steps.version.outputs.content }}.zip.hash.txt | ||
AntiDupl.NET-${{ steps.version.outputs.content }}_SingleFilePortable.exe | ||
AntiDupl.NET-${{ steps.version.outputs.content }}_SingleFilePortable.exe.hash.txt | ||
AntiDupl.NET-${{ steps.version.outputs.content }}_SingleFilePortable.zip | ||
AntiDupl.NET-${{ steps.version.outputs.content }}_SingleFilePortable.zip.hash.txt | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
@echo off | ||
|
||
set RAR_EXE="C:\Program Files\WinRAR\WinRar.exe" | ||
|
||
set ROOT_DIR=.. | ||
set VERSION_FILE=%ROOT_DIR%\src\version.txt | ||
|
||
if not exist %VERSION_FILE% ( | ||
echo Can't find "%VERSION_FILE%" file! | ||
exit 0 | ||
) | ||
|
||
set VERSION= | ||
for /f "delims=" %%i in ('type %VERSION_FILE%') do set VERSION=%%i | ||
|
||
set OUT_DIR=%ROOT_DIR%\out\publish | ||
set TMP_DIR=%ROOT_DIR%\out\publish\AntiDupl.NET-%VERSION% | ||
|
||
if not exist %OUT_DIR% mkdir %OUT_DIR% | ||
|
||
if exist %TMP_DIR% ( | ||
echo Delete old files: | ||
erase %TMP_DIR%\* /q /s /f | ||
rmdir %TMP_DIR% /q /s | ||
) | ||
|
||
if not exist %TMP_DIR% mkdir %TMP_DIR% | ||
|
||
set PUBLISH_DIR=%ROOT_DIR%\out\publish\AntiDupl.NET | ||
|
||
robocopy "%ROOT_DIR%\data\resources" "%PUBLISH_DIR%\data\resources" /MIR | ||
if %ERRORLEVEL% GEQ 8 exit 0 | ||
robocopy "%ROOT_DIR%\docs\data\resources" "%PUBLISH_DIR%\data\resources" /S | ||
if %ERRORLEVEL% GEQ 8 exit 0 | ||
|
||
xcopy %ROOT_DIR%\bin\Publish\AntiDupl.dll %PUBLISH_DIR% /y | ||
xcopy %ROOT_DIR%\bin\Publish\AntiDupl.pdb %PUBLISH_DIR% /y | ||
xcopy %ROOT_DIR%\bin\Publish\AntiDupl.NET.WinForms.runtimeconfig.json %PUBLISH_DIR% /y | ||
xcopy %ROOT_DIR%\bin\Publish\AntiDupl.NET.WPF.runtimeconfig.json %PUBLISH_DIR% /y | ||
|
||
xcopy %PUBLISH_DIR% %TMP_DIR% /y /i /s | ||
|
||
if exist %RAR_EXE% ( | ||
%RAR_EXE% a -ep1 -s -m5 -r -sfx %OUT_DIR%\AntiDupl.NET-%VERSION%_SingleFilePortable.exe %TMP_DIR% | ||
certutil -hashfile %OUT_DIR%\AntiDupl.NET-%VERSION%.exe SHA256 > %OUT_DIR%\AntiDupl.NET-%VERSION%_SingleFilePortable.exe.hash.txt | ||
%RAR_EXE% a -afzip -ep1 -r %OUT_DIR%\AntiDupl.NET-%VERSION%_SingleFilePortable.zip %TMP_DIR% | ||
certutil -hashfile %OUT_DIR%\AntiDupl.NET-%VERSION%.zip SHA256 > %OUT_DIR%\AntiDupl.NET-%VERSION%_SingleFilePortable.zip.hash.txt | ||
) else ( | ||
.\7-zip\7za_2201.exe a -sfx7z.sfx %OUT_DIR%\AntiDupl.NET-%VERSION%_SingleFilePortable.exe %TMP_DIR% | ||
certutil -hashfile %OUT_DIR%\AntiDupl.NET-%VERSION%_SingleFilePortable.exe SHA256 > %OUT_DIR%\AntiDupl.NET-%VERSION%_SingleFilePortable.exe.hash.txt | ||
.\7-zip\7za_2201.exe a -tzip %OUT_DIR%\AntiDupl.NET-%VERSION%_SingleFilePortable.zip .\%TMP_DIR%\* | ||
certutil -hashfile %OUT_DIR%\AntiDupl.NET-%VERSION%_SingleFilePortable.zip SHA256 > %OUT_DIR%\AntiDupl.NET-%VERSION%_SingleFilePortable.zip.hash.txt | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/AntiDupl.NET.Core/Properties/PublishProfiles/AntiDuplPublishSingleFile.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project> | ||
<PropertyGroup> | ||
<Configuration>Publish</Configuration> | ||
<Platform>x64</Platform> | ||
<PublishDir>..\..\bin\Publish\</PublishDir> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<_TargetId>Folder</_TargetId> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
<SelfContained>true</SelfContained> | ||
<PublishSingleFile>false</PublishSingleFile> | ||
<PublishReadyToRun>false</PublishReadyToRun> | ||
<PublishTrimmed>false</PublishTrimmed> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/AntiDupl.NET.WPF/Properties/PublishProfiles/AntiDuplPublishSingleFile.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project> | ||
<PropertyGroup> | ||
<Configuration>Publish</Configuration> | ||
<Platform>x64</Platform> | ||
<PublishDir>..\..\out\Publish\AntiDupl.NET</PublishDir> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<_TargetId>Folder</_TargetId> | ||
<TargetFramework>net6.0-windows</TargetFramework> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
<SelfContained>true</SelfContained> | ||
<PublishSingleFile>true</PublishSingleFile> | ||
<PublishReadyToRun>true</PublishReadyToRun> | ||
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile> | ||
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract> | ||
<DeleteExistingFiles>True</DeleteExistingFiles> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.