Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

コード署名する #852

Merged
merged 7 commits into from
Jul 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 69 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,29 @@ on:
types:
- created
workflow_dispatch:
inputs:
version:
description: "バージョン情報(A.BB.C / A.BB.C-preview.D)"
required: true
prerelease:
description: "プレリリースかどうか"
type: boolean
default: true
code_signing:
description: "コード署名する"
type: boolean

env:
VOICEVOX_ENGINE_REPO_URL: "https://github.com/VOICEVOX/voicevox_engine"
VOICEVOX_ENGINE_VERSION: 0.12.2
VOICEVOX_RESOURCE_VERSION: 0.12.1
VOICEVOX_EDITOR_VERSION:
|- # releaseのときはタグが、それ以外は999.999.999がバージョン名に
${{ github.event.release.tag_name != '' && github.event.release.tag_name || '999.999.999' }}
|- # releaseタグ名か、workflow_dispatchでのバージョン名か、999.999.999が入る
${{ github.event.release.tag_name || github.event.inputs.version || '999.999.999' }}

jobs:
build-noengine-prepackage:
environment: ${{ github.event.inputs.code_signing == 'true' && 'code_signing' }} # コード署名用のenvironment(false時の挙動は2022年7月10日時点で未定義動作)
env:
CYPRESS_CACHE_FOLDER: ~/.npm/cypress_cache
ELECTRON_CACHE: .cache/electron
Expand Down Expand Up @@ -246,6 +258,19 @@ jobs:
run: |
df -h

# build electronでコード署名するには環境変数を指定が必要だけど、
# コード署名しない場合に環境変数を定義するとエラーになるので、動的に環境変数を足す
- name: Define Code Signing Envs
if: startsWith(matrix.os, 'windows-') && github.event.inputs.code_signing == 'true'
shell: bash
run: |
# 複数行の文字列を環境変数に代入
echo 'CSC_LINK<<EOF' >> $GITHUB_ENV
echo "${{ secrets.CERT_BASE64 }}" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV

echo 'CSC_KEY_PASSWORD=${{ secrets.CERT_PASSWORD }}' >> $GITHUB_ENV

# Build result will be exported to ${{ matrix.artifact_path }}
- name: Build Electron
shell: bash
Expand All @@ -256,6 +281,13 @@ jobs:
MACOS_ARTIFACT_NAME: ${{ matrix.macos_artifact_name }}
run: npm run electron:build_pnever -- --dir

- name: Reset Code Signing Envs
if: startsWith(matrix.os, 'windows-') && github.event.inputs.code_signing == 'true'
shell: bash
run: |
echo 'CSC_LINK=' >> $GITHUB_ENV
echo 'CSC_KEY_PASSWORD=' >> $GITHUB_ENV

- name: Upload NoEngine Prepackage
uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -504,8 +536,9 @@ jobs:
path: "${{ matrix.compressed_artifact_name }}-${{ env.VOICEVOX_EDITOR_VERSION }}.zip"

build-distributable:
if: github.event.release.tag_name != '' # If release
if: (github.event.release.tag_name || github.event.inputs.version) != '' # If release
needs: [build-engine-prepackage]
environment: ${{ github.event.inputs.code_signing == 'true' && 'code_signing' }} # コード署名用のenvironment
env:
CYPRESS_CACHE_FOLDER: ~/.npm/cypress_cache
ELECTRON_CACHE: .cache/electron
Expand Down Expand Up @@ -677,6 +710,19 @@ jobs:
run: |
df -h

# build electronでコード署名するには環境変数を指定が必要だけど、
# コード署名しない場合に環境変数を定義するとエラーになるので、動的に環境変数を足す
- name: Define Code Signing Envs
if: endsWith(matrix.artifact_name, '-nsis-web') && github.event.inputs.code_signing == 'true'
shell: bash
run: |
# 複数行の文字列を環境変数に代入
echo 'CSC_LINK<<EOF' >> $GITHUB_ENV
echo "${{ secrets.CERT_BASE64 }}" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV

echo 'CSC_KEY_PASSWORD=${{ secrets.CERT_PASSWORD }}' >> $GITHUB_ENV

# NOTE: prepackage can be removed before splitting nsis-web archive
- name: Build Electron
if: endsWith(matrix.artifact_name, '-nsis-web') || endsWith(matrix.artifact_name, '-appimage') # windows and linux
Expand All @@ -694,6 +740,13 @@ jobs:
MACOS_ARTIFACT_NAME: ${{ matrix.macos_artifact_name }}
run: npm run electron:build_pnever -- --prepackaged "prepackage/VOICEVOX.app"

- name: Reset Code Signing Envs
if: endsWith(matrix.artifact_name, '-nsis-web') && github.event.inputs.code_signing == 'true'
shell: bash
run: |
echo 'CSC_LINK=' >> $GITHUB_ENV
echo 'CSC_KEY_PASSWORD=' >> $GITHUB_ENV

- name: Show disk space (debug info)
shell: bash
run: |
Expand Down Expand Up @@ -743,7 +796,7 @@ jobs:
nsis-web-artifact/*

upload-distributable-to-release:
if: github.event.release.tag_name != '' # If release
if: (github.event.release.tag_name || github.event.inputs.version) != '' # If release
needs: [build-distributable]
strategy:
fail-fast: false
Expand Down Expand Up @@ -832,7 +885,8 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }} # == github.event.release.tag_name
tag: ${{ env.VOICEVOX_EDITOR_VERSION }}
prerelease: ${{ github.event.inputs.prerelease }}
file_glob: true
file: artifact/*.7z.*

Expand All @@ -842,7 +896,8 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }} # == github.event.release.tag_name
tag: ${{ env.VOICEVOX_EDITOR_VERSION }}
prerelease: ${{ github.event.inputs.prerelease }}
file_glob: true
file: artifact/*.7z.*

Expand All @@ -851,7 +906,8 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }} # == github.event.release.tag_name
tag: ${{ env.VOICEVOX_EDITOR_VERSION }}
prerelease: ${{ github.event.inputs.prerelease }}
file_glob: true
file: artifact/*.exe

Expand All @@ -861,7 +917,8 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }} # == github.event.release.tag_name
tag: ${{ env.VOICEVOX_EDITOR_VERSION }}
prerelease: ${{ github.event.inputs.prerelease }}
file_glob: true
file: artifact/*.dmg

Expand All @@ -871,7 +928,8 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }} # == github.event.release.tag_name
tag: ${{ env.VOICEVOX_EDITOR_VERSION }}
prerelease: ${{ github.event.inputs.prerelease }}
file_glob: true
file: artifact/*.tar.gz

Expand All @@ -881,6 +939,7 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }} # == github.event.release.tag_name
tag: ${{ env.VOICEVOX_EDITOR_VERSION }}
prerelease: ${{ github.event.inputs.prerelease }}
file_glob: true
file: artifact/*.zip