v1.0.41: WebView2 ユーザーデータフォルダを %APPDATA% に明示指定(Program Files 配下では既定フォ… #53
Workflow file for this run
This file contains hidden or 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
| # 社内知恵袋 - 自動ビルド・コード署名・GitHub Releases 配布 | |
| # | |
| # - v* タグを push すると: Windows 上で Inno Setup ビルド → SignPath でコード署名 → | |
| # 署名済み ShineosQA-Setup-<version>.exe をリリースに自動添付 | |
| # - workflow_dispatch で: ビルド・署名のみ(アーティファクト確認用) | |
| # | |
| # 必要な設定(リポジトリ Settings > Secrets and variables > Actions): | |
| # Secrets: SIGNPATH_ORG_ID / SIGNPATH_API_TOKEN | |
| # Variables: SIGNPATH_PROJECT_SLUG / SIGNPATH_SIGNING_POLICY_SLUG | |
| # (SignPathコンソールで確認したスラッグに置き換えること) | |
| # | |
| # 注意: Inno Setup は 6.7.3(最終6系)を使用する。 | |
| # 7系は API が変更され、かつ「Non-commercial use only」のため商用利用に | |
| # ライセンスが必要になる可能性がある。6系は商用利用が無償。 | |
| name: build-release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| actions: read | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Inno Setup 6.7.3 | |
| shell: pwsh | |
| run: | | |
| $iscc = 'C:\InnoSetup\ISCC.exe' | |
| if (-not (Test-Path $iscc)) { | |
| # 公式GitHubリリースから直接取得(download.php はスタブHTMLを返すため不使用) | |
| curl.exe -L --fail --retry 3 -o "$env:TEMP\innosetup.exe" https://github.com/jrsoftware/issrc/releases/download/is-6_7_3/innosetup-6.7.3.exe | |
| if ($LASTEXITCODE -ne 0) { throw "Inno Setup download failed" } | |
| $size = (Get-Item "$env:TEMP\innosetup.exe").Length | |
| if ($size -lt 5MB) { throw "Inno Setup download looks invalid (${size} bytes)" } | |
| # /DIR でインストール先を固定(既定の導入先はバージョンで異なるため) | |
| $p = Start-Process -FilePath "$env:TEMP\innosetup.exe" ` | |
| -ArgumentList @('/VERYSILENT','/SUPPRESSMSGBOXES','/NORESTART','/SP-','/DIR=C:\InnoSetup') ` | |
| -Wait -PassThru | |
| if ($p.ExitCode -ne 0) { throw "Inno Setup installer exit code: $($p.ExitCode)" } | |
| } | |
| if (-not (Test-Path $iscc)) { | |
| # 想定外の導入先でも探索 | |
| $iscc = Get-ChildItem 'C:\Program Files', 'C:\Program Files (x86)', "$env:LOCALAPPDATA\Programs" ` | |
| -Directory -Filter 'Inno Setup*' -ErrorAction SilentlyContinue | | |
| ForEach-Object { Join-Path $_.FullName 'ISCC.exe' } | | |
| Where-Object { Test-Path $_ } | Select-Object -First 1 | |
| } | |
| if (-not $iscc) { throw "ISCC.exe not found" } | |
| Write-Output "ISCC: $iscc" | |
| Write-Output "ISCC_PATH=$iscc" >> $env:GITHUB_ENV | |
| # WebView2 ラッパーアプリ(dist\ShineosQA.App)は .gitignore で除外されているため、 | |
| # CI のクリーンな checkout には存在しない。installer.iss が参照するため先にビルドする | |
| # (過去の失敗: v1.0.28 で "No files found matching ...dist\ShineosQA.App\*" が発生) | |
| - name: Build WebView2 wrapper app | |
| shell: pwsh | |
| run: | | |
| & .\app\ShineosQA.App\build.ps1 | |
| if ($LASTEXITCODE -ne 0) { throw "WebView2 app build failed (exit $LASTEXITCODE)" } | |
| Get-ChildItem dist\ShineosQA.App | Select-Object Name, Length | |
| - name: Build installer | |
| shell: pwsh | |
| run: | | |
| & $env:ISCC_PATH installer\installer.iss | |
| if ($LASTEXITCODE -ne 0) { throw "ISCC failed with exit code $LASTEXITCODE" } | |
| Get-ChildItem dist | Select-Object Name, Length | |
| # ---- SignPath コード署名(REST API 直接方式) ---- | |
| # GitHubコネクタ(Trusted Build System)は組織設定が必須でAPIから設定不可のため、 | |
| # SignPath REST API に直接署名リクエストを送る方式を使用(2026-08-21 実証済み) | |
| - name: Sign with SignPath (direct API) | |
| shell: pwsh | |
| env: | |
| SIGNPATH_API_TOKEN: ${{ secrets.SIGNPATH_API_TOKEN }} | |
| SIGNPATH_ORG_ID: ${{ secrets.SIGNPATH_ORG_ID }} | |
| SIGNPATH_PROJECT_SLUG: ${{ vars.SIGNPATH_PROJECT_SLUG }} | |
| SIGNPATH_SIGNING_POLICY_SLUG: ${{ vars.SIGNPATH_SIGNING_POLICY_SLUG }} | |
| run: | | |
| $exe = Get-ChildItem dist -Filter *.exe | Select-Object -First 1 | |
| if (-not $exe) { throw 'no exe found in dist' } | |
| & .\scripts\sign_with_signpath.ps1 -ArtifactPath $exe.FullName -OutputPath "dist\signed-tmp.exe" | |
| if ($LASTEXITCODE -ne 0) { throw "SignPath signing failed (exit $LASTEXITCODE)" } | |
| Move-Item -Force "dist\signed-tmp.exe" $exe.FullName | |
| Get-ChildItem dist | Select-Object Name, Length | |
| - name: Upload artifact (manual build) | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ShineosQA-Setup | |
| path: dist/*.exe | |
| if-no-files-found: error | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/*.exe | |
| generate_release_notes: true |