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

ダウンローダの自動ビルドを条件付きに #560

Merged
Show file tree
Hide file tree
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
60 changes: 0 additions & 60 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ on:
- published
pull_request:
push:
branches:
- "*"
- "**/*"
Comment on lines -29 to -31
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これが書かれているとこと書かれてないとこがあったので、書かない方針の方に統一してみました。


env:
VOICEVOX_RESOURCE_VERSION: "0.15.0-preview.1"
Expand Down Expand Up @@ -398,60 +395,3 @@ jobs:
files: |-
scripts/downloads/*
target_commitish: ${{ github.sha }}

deploy_precompiled_downloader:
environment: ${{ github.event.inputs.is_production == 'true' && 'production' || '' }} # コード署名用のenvironment
strategy:
matrix:
include:
- name: download-windows-x64.exe
target: x86_64-pc-windows-msvc
os: windows-2019
- name: download-linux-x64
target: x86_64-unknown-linux-gnu
os: ubuntu-20.04
- name: download-linux-arm64
target: aarch64-unknown-linux-gnu
os: ubuntu-20.04
- name: download-osx-x64
target: x86_64-apple-darwin
os: macos-11
- name: download-osx-arm64
target: aarch64-apple-darwin
os: macos-11
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install cross compiler for aarch64-unknown-linux-gnu
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Set up ${{ matrix.target }}
uses: ./.github/actions/rust-toolchain-from-file
with:
targets: ${{ matrix.target }}
- name: Build downloader
run: cargo build -vv --release -p download --target ${{ matrix.target }}
- name: Rename the binary
run: |
case "$OS" in
Windows) exe_suffix=.exe;;
Linux | macOS) exe_suffix=;;
esac
mv $"target/${{ matrix.target }}/release/download$exe_suffix" ./${{ matrix.name }}
- name: Code signing (Windows)
if: startsWith(matrix.os, 'windows') && github.event.inputs.code_signing == 'true'
run: |
bash build_util/codesign.bash ./${{ matrix.name }}
env:
CERT_BASE64: ${{ secrets.CERT_BASE64 }}
CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }}
- name: Upload to Release
if: env.VERSION != '0.0.0'
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: ${{ env.VERSION }}
files: ${{ matrix.name }}
target_commitish: ${{ github.sha }}
111 changes: 111 additions & 0 deletions .github/workflows/build_and_deploy_downloader.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: build and deploy downloader workflow

on:
workflow_dispatch:
inputs:
version:
description: "バージョン情報(A.BB.C / A.BB.C-preview.D)"
required: true
code_signing:
description: "コード署名する"
type: boolean
required: false
default: false
is_production:
description: "製品版をビルドする"
type: boolean
required: false
default: false
release:
types:
- published
pull_request:
paths:
- Cargo.*
- rust-toolchain
- crates/download/**
- .github/workflows/build_and_deploy_downloader.yml
push:
paths:
- Cargo.*
- rust-toolchain
- crates/download/**
- .github/workflows/build_and_deploy_downloader.yml

env:
# releaseタグ名か、workflow_dispatchでのバージョン名か、'0.0.0'が入る
VERSION: ${{ github.event.release.tag_name || github.event.inputs.version || '0.0.0' }}

defaults:
run:
shell: bash

jobs:
deploy_and_deploy_downloader:
environment: ${{ github.event.inputs.is_production == 'true' && 'production' || '' }} # コード署名用のenvironment
strategy:
matrix:
include:
- name: download-windows-x64.exe
target: x86_64-pc-windows-msvc
os: windows-2019

- name: download-linux-x64
target: x86_64-unknown-linux-gnu
os: ubuntu-20.04

- name: download-linux-arm64
target: aarch64-unknown-linux-gnu
os: ubuntu-20.04

- name: download-osx-x64
target: x86_64-apple-darwin
os: macos-11

- name: download-osx-arm64
target: aarch64-apple-darwin
os: macos-11

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3

- name: Install cross compiler for aarch64-unknown-linux-gnu
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

- name: Set up ${{ matrix.target }}
uses: ./.github/actions/rust-toolchain-from-file
with:
targets: ${{ matrix.target }}

- name: Build downloader
run: cargo build -vv --release -p download --target ${{ matrix.target }}

- name: Rename the binary
run: |
case "$OS" in
Windows) exe_suffix=.exe;;
Linux | macOS) exe_suffix=;;
esac
mv $"target/${{ matrix.target }}/release/download$exe_suffix" ./${{ matrix.name }}

- name: Code signing (Windows)
if: startsWith(matrix.os, 'windows') && github.event.inputs.code_signing == 'true'
run: |
bash build_util/codesign.bash ./${{ matrix.name }}
env:
CERT_BASE64: ${{ secrets.CERT_BASE64 }}
CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }}

- name: Upload to Release
if: env.VERSION != '0.0.0'
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: ${{ env.VERSION }}
files: ${{ matrix.name }}
target_commitish: ${{ github.sha }}
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: test workflow

on:
push:
branches:
- "*"
- "**/*"
pull_request:
workflow_dispatch:

Expand Down