Skip to content

Commit

Permalink
バッチでビルドし、コード署名するように変更
Browse files Browse the repository at this point in the history
  • Loading branch information
takke committed Jan 18, 2019
1 parent bf66db1 commit c78a03e
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ ASALocalRun/
# MFractors (Xamarin productivity tool) working folder
.mfractor/

#
# local file
#
/image/2018-12-19_16h24_46.mp4
/image/make_gif_by_ffmpeg.txt
/packaging
33 changes: 33 additions & 0 deletions 100_build_exe.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@echo off

REM --------------------------------------------------
REM 各ビルド環境用の環境変数設定
REM --------------------------------------------------
REM https://www.appveyor.com/docs/environment-variables/
if "%APPVEYOR%"=="True" (
set EXTRA_CMD=/verbosity:minimal /logger:"%ProgramFiles%\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
set MSBUILD_PATH=msbuild
set SLN_PATH="%APPVEYOR_BUILD_FOLDER%\CompactMeter.sln"
) else (
set EXTRA_CMD=
set MSBUILD_PATH="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe"
set SLN_PATH=CompactMeter.sln
)

REM --------------------------------------------------
REM 32bit build
REM --------------------------------------------------
set CMD=%MSBUILD_PATH% %SLN_PATH% /p:Platform=x86 /p:Configuration=Release /t:"Build" %EXTRA_CMD%
echo.
echo %CMD%
echo.
%CMD%

REM --------------------------------------------------
REM 64bit build
REM --------------------------------------------------
set CMD=%MSBUILD_PATH% %SLN_PATH% /p:Platform=x64 /p:Configuration=Release /t:"Build" %EXTRA_CMD%
echo.
echo %CMD%
echo.
%CMD%
62 changes: 62 additions & 0 deletions 200_packaging.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@echo off

set BASE_DIR=%~dp0

REM --------------------------------------------------
REM 各ビルド環境用の環境変数設定
REM --------------------------------------------------
REM https://www.appveyor.com/docs/environment-variables/
if "%APPVEYOR%"=="True" (
set ZIP_CMD=7z
REM ARTIFACT_VERSION は appveyor.yml の before_build: で設定済
) else (
set ZIP_CMD="C:\Program Files\7-Zip\7z"
set ARTIFACT_VERSION=X_X_X
)

REM --------------------------------------------------
REM 作業ディレクトリの準備
REM --------------------------------------------------
set WORK_DIR=%BASE_DIR%packaging
rmdir /S /Q %WORK_DIR%
mkdir %WORK_DIR%
if %errorlevel% neq 0 (echo error && exit /b 1)

REM --------------------------------------------------
REM ファイル収集
REM --------------------------------------------------
echo.
echo collect files
echo.
copy /Y /B Release\CompactMeter.exe %WORK_DIR%
copy /Y /B Release\register.exe %WORK_DIR%
copy /Y /B x64\Release\CompactMeter_64.exe %WORK_DIR%
copy /Y /B README.md %WORK_DIR%

REM --------------------------------------------------
REM コード署名
REM --------------------------------------------------
if "%APPVEYOR%"=="True" (
echo.
echo skip sign
echo.
) else (
echo.
echo sign
echo.
set SIGNTOOL="C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\signtool"
%SIGNTOOL% sign /a /fd SHA256 /v /tr http://timestamp.comodoca.com/?td=sha256 /td sha256 ^
%WORK_DIR%\CompactMeter.exe ^
%WORK_DIR%\CompactMeter_64.exe ^
%WORK_DIR%\register.exe
)

REM --------------------------------------------------
REM ZIP
REM --------------------------------------------------
echo.
echo ZIP
echo.
cd %WORK_DIR%
%ZIP_CMD% a CompactMeter_v%ARTIFACT_VERSION%.zip CompactMeter.exe CompactMeter_64.exe register.exe README.md
cd ..
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ Direct2D 対応なのでCPU負荷を低く抑えています。

## 変更履歴

### v1.2.0 (2019.01.xx)
### v1.2.0 (2019.01.18)
- 実行ファイルにデジタル署名するようにした
- 背景色変更機能を追加
- ドライブのメーターを各ドライブ単位でOn/Offできるように変更
- 自動起動設定を追加
Expand All @@ -57,3 +58,20 @@ Direct2D 対応なのでCPU負荷を低く抑えています。
### v1.0.0 (2018.12.27)

- 初版リリース


## 開発メモ

### 前提
- 開発環境: Visual Studio Community 2017
- OS: Windows 10 Pro 64bit
- 7-Zip (64bit版)
- デジタル署名する場合:コード証明書がインストール済みであること

### リリース作業

- 下記を順に実行する
- `100_build_exe.bat`
- `200_packaging.bat`
- `packaging` 内の各ファイルがデジタル署名済みであることを確認する
- `packaging/CompactMeter_vXXX.zip` をリネームし GitHub の Releases にアップロードする
13 changes: 4 additions & 9 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,12 @@ before_build:
# "1.1.0.76" -> "1_1_0_76"
- set ARTIFACT_VERSION=%APPVEYOR_BUILD_VERSION:.=_%

build:
project: CompactMeter.sln
build_script:
- 100_build_exe.bat

after_build:
# 64bit build
- msbuild "%APPVEYOR_BUILD_FOLDER%\CompactMeter.sln" /p:Platform=x64 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
# packaging
- copy Release\CompactMeter.exe .
- copy Release\register.exe .
- copy x64\Release\CompactMeter_64.exe .
- 7z a CompactMeter_v%ARTIFACT_VERSION%.zip CompactMeter.exe CompactMeter_64.exe register.exe README.md
- 200_packaging.bat

artifacts:
- path: CompactMeter_v$(ARTIFACT_VERSION).zip
- path: packaging/CompactMeter_v$(ARTIFACT_VERSION).zip

0 comments on commit c78a03e

Please sign in to comment.