Skip to content

Commit

Permalink
Merge pull request Dn-Programming-Core-Management#237 from Gumball241…
Browse files Browse the repository at this point in the history
…5/main

Improve CI build workflow
  • Loading branch information
Gumball2415 authored Oct 24, 2023
2 parents dfb2d2f + 53f9493 commit 1e2b5cb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 18 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/build-artifact.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: build-artifact
on: push

env:
commithash: ""
jobs:
build-matrix:
runs-on: windows-2022
Expand All @@ -12,17 +13,18 @@ jobs:
- uses: actions/checkout@master
with:
fetch-depth: 0
- name: Set commit hash variable
shell: powershell
run: echo "commithash=$(git describe --tags)" >> $env:GITHUB_ENV
- name: Build program
shell: cmd
run: |
for /f "tokens=*" %%a in ('git describe --tags') do (set commithash=%%a)
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsamd64_x86.bat"
call msbuild -m:5 -nologo -p:Configuration="${{ matrix.configuration }}" -p:Platform="${{ matrix.platform }}"
if %ERRORLEVEL%==1 exit %ERRORLEVEL%
call release.bat ${{ matrix.configuration }} ${{ matrix.platform }} %commithash%_%GITHUB_RUN_ID%
call release.bat ${{ matrix.configuration }} ${{ matrix.platform }} ${{ env.commithash }}_${{ github.run_id }}
- name: Upload binaries
uses: actions/upload-artifact@master
with:
name: build-artifacts
path: distribute/*.7z
name: Dn-FamiTracker_${{ env.commithash }}_${{ github.run_id }}_${{ matrix.platform }}_${{ matrix.configuration }}
path: distribute/*_${{ matrix.platform }}_${{ matrix.configuration }}.7z
31 changes: 23 additions & 8 deletions .github/workflows/build-release-artifact.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
name: build-artifact-publish
on:
release:
types: [published]
push:
tags:
- "*"
jobs:
build-matrix-publish:
runs-on: windows-2022
strategy:
matrix:
platform: [x64, Win32]
configuration: [Release, Debug]
# configuration is Release only
steps:
- uses: actions/checkout@master
- name: Build program
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsamd64_x86.bat"
call msbuild -m:5 -nologo -p:Configuration="${{ matrix.configuration }}" -p:Platform="${{ matrix.platform }}"
call msbuild -m:5 -nologo -p:Configuration="Release" -p:Platform="${{ matrix.platform }}"
if %ERRORLEVEL%==1 exit %ERRORLEVEL%
call release.bat ${{ matrix.configuration }} ${{ matrix.platform }}
call release.bat Release ${{ matrix.platform }}
- name: Upload binaries
uses: actions/upload-artifact@master
with:
name: build-artifacts
path: distribute/*.7z
path: distribute/*_${{ matrix.platform }}_Release.7z
publish-build:
needs: build-matrix-publish
runs-on: windows-2022
steps:
- uses: actions/download-artifact@master
- name: Download binaries
shell: powershell
run: ls -R
- name: Upload release
uses: marvinpinto/action-automatic-releases@master
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
draft: true
prerelease: false
automatic_release_tag: draft
files: artifact/*.7z
6 changes: 2 additions & 4 deletions release.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ del distribute /q /f
mkdir distribute

if "%2"=="Win32" (
set conf_name=x86
goto continue
)
if "%2"=="x64" (
set conf_name=x64
goto continue
)
goto endfile
Expand All @@ -18,7 +16,7 @@ goto endfile
if "%~3"=="" goto compileversion

cd %2/%1/
call 7z a -t7z -mx=9 -mmt=3 -m0=LZMA2:d=26:fb=128 -ms=on ..\..\distribute\Dn-FamiTracker_"%~3"_%conf_name%_"%~1".7z Dn-FamiTracker.exe Dn-FamiTracker.chm Dn-FamiTracker.pdb vc143.pdb ..\..\changelog.txt ..\..\demo
call 7z a -t7z -mx=9 -mmt=3 -m0=LZMA2:d=26:fb=128 -ms=on ..\..\distribute\Dn-FamiTracker_"%~3"_"%~2"_"%~1".7z Dn-FamiTracker.exe Dn-FamiTracker.chm Dn-FamiTracker.pdb vc143.pdb ..\..\changelog.txt ..\..\demo
cd ..\..
goto endfile

Expand All @@ -29,6 +27,6 @@ for /F "tokens=1,2,3,4,5 delims=, " %%A in (Dn-FamiTracker.rc) do (
)
)
cd %2/%1/
call 7z a -t7z -mx=9 -mmt=3 -m0=LZMA2:d=26:fb=128 -ms=on ..\..\distribute\Dn-FamiTracker_%version%_%conf_name%_"%~1".7z Dn-FamiTracker.exe Dn-FamiTracker.chm Dn-FamiTracker.pdb vc143.pdb ..\..\changelog.txt ..\..\demo
call 7z a -t7z -mx=9 -mmt=3 -m0=LZMA2:d=26:fb=128 -ms=on ..\..\distribute\Dn-FamiTracker_%version%_"%~2"_"%~1".7z Dn-FamiTracker.exe Dn-FamiTracker.chm Dn-FamiTracker.pdb vc143.pdb ..\..\changelog.txt ..\..\demo
cd ..\..
:endfile

0 comments on commit 1e2b5cb

Please sign in to comment.