Skip to content

Release: version 1.3.2 #109

Release: version 1.3.2

Release: version 1.3.2 #109

Workflow file for this run

name: Build
on:
push:
workflow_call:
workflow_dispatch:
jobs:
build-linux:
strategy:
fail-fast: false # 一つのビルドが失敗しても他のビルドは継続する
matrix:
include:
# x64 アーキテクチャ向けのビルド設定
- arch: amd64
runner: ubuntu-22.04
artifact_suffix: ''
# arm64 アーキテクチャ向けのビルド設定
- arch: arm64
runner: ubuntu-22.04-arm
artifact_suffix: '-arm'
runs-on: ${{ matrix.runner }}
steps:
# Docker Buildx のセットアップ
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Dockerfile を作成
- name: Create Dockerfile
run: |
cat <<EOF > Dockerfile
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common && \
add-apt-repository -y ppa:deadsnakes/ppa && \
apt-get install -y \
build-essential \
curl \
patchelf \
python3.11 \
python3.11-dev \
python3.11-distutils \
python3.11-venv \
zlib1g \
zlib1g-dev
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.11
RUN python3.11 -m pip install poetry
EOF
# Ubuntu 20.04 の Docker イメージをビルド
- name: Build Docker Image
uses: docker/build-push-action@v5
with:
context: .
tags: ubuntu:20.04-custom
cache-from: type=gha,scope=ubuntu:20.04-custom(${{ matrix.arch }})
cache-to: type=gha,scope=ubuntu:20.04-custom(${{ matrix.arch }}),mode=max
load: true
# Dockerfile を削除
- name: Remove Dockerfile
run: rm Dockerfile
# ISDBScanner のソースコードをチェックアウト
- name: Checkout Repository
uses: actions/checkout@v4
# ISDBScanner を PyInstaller でビルド
# arm64 ビルドではリリースでの区別のため、ファイル名を isdb-scanner-arm に変更する
- name: Build with PyInstaller
run: |
docker run --rm -i -v $(pwd):/work -w /work ubuntu:20.04-custom bash -c \
'poetry install && poetry run pyinstaller --onefile --collect-submodules shellingham --name=isdb-scanner${{ matrix.artifact_suffix }} isdb_scanner/__main__.py'
# 単一実行ファイルにビルドされたバイナリを Artifact としてアップロード
- name: Upload Executable as Artifact
uses: actions/upload-artifact@v4
with:
name: isdb-scanner${{ matrix.artifact_suffix }}
path: dist/isdb-scanner${{ matrix.artifact_suffix }}
# Wheel をビルド
# ISDBScanner 自体は Pure Python パッケージなので、重複回避のため x64 版のみ実行
- name: Build Wheel
if: matrix.arch == 'amd64'
run: |
docker run --rm -i -v $(pwd):/work -w /work ubuntu:20.04-custom bash -c \
'poetry build'
# Wheel を Artifact としてアップロード
# ISDBScanner 自体は Pure Python パッケージなので、重複回避のため x64 版のみ実行
- name: Upload Wheel as Artifact
if: matrix.arch == 'amd64'
uses: actions/upload-artifact@v4
with:
name: isdb-scanner-wheel
path: dist/isdb_scanner-*.whl
# タグが push されたときのみ実行
release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-22.04
needs:
- build-linux
permissions:
contents: write
steps:
# Artifact をダウンロード (x86_64)
- name: Download Artifact (x86_64)
uses: actions/download-artifact@v4
with:
name: isdb-scanner
path: dist
# Artifact をダウンロード (arm64)
- name: Download Artifact (arm64)
uses: actions/download-artifact@v4
with:
name: isdb-scanner-arm
path: dist
# Artifact をダウンロード (wheel)
- name: Download Artifact (wheel)
uses: actions/download-artifact@v4
with:
name: isdb-scanner-wheel
path: dist
# リリースを作成
- name: Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
./dist/isdb-scanner
./dist/isdb-scanner-arm
./dist/isdb_scanner-*.whl