Update major dependencies #483
This file contains 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
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/downloader/** | |
- .github/workflows/build_and_deploy_downloader.yml | |
push: | |
paths: | |
- Cargo.* | |
- rust-toolchain | |
- crates/downloader/** | |
- .github/workflows/build_and_deploy_downloader.yml | |
env: | |
# releaseタグ名か、workflow_dispatchでのバージョン名か、'0.0.0'が入る | |
VERSION: ${{ github.event.release.tag_name || inputs.version || '0.0.0' }} | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
deploy_and_deploy_downloader: | |
environment: ${{ inputs.is_production && '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-12 | |
- name: download-osx-arm64 | |
target: aarch64-apple-darwin | |
os: macos-12 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 downloader --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') && inputs.code_signing | |
run: | | |
bash build_util/codesign.bash ./${{ matrix.name }} | |
env: | |
ESIGNERCKA_USERNAME: ${{ secrets.ESIGNERCKA_USERNAME }} | |
ESIGNERCKA_PASSWORD: ${{ secrets.ESIGNERCKA_PASSWORD }} | |
ESIGNERCKA_TOTP_SECRET: ${{ secrets.ESIGNERCKA_TOTP_SECRET }} | |
- name: Upload to Release | |
if: env.VERSION != '0.0.0' | |
uses: softprops/action-gh-release@v2 | |
with: | |
prerelease: true | |
tag_name: ${{ env.VERSION }} | |
files: ${{ matrix.name }} | |
target_commitish: ${{ github.sha }} |