Release: version 1.1.6 #80
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 | |
on: | |
push: | |
workflow_call: | |
workflow_dispatch: | |
jobs: | |
build-linux: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Install and configure Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-in-project: true | |
- name: Setup Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'poetry' | |
cache-dependency-path: '${{ github.workspace }}/poetry.lock' | |
- name: Install Dependencies | |
run: | | |
pip install poetry | |
poetry install | |
- name: Build with PyInstaller | |
run: | | |
poetry run pyinstaller --onefile --name=isdb-scanner isdb_scanner/__main__.py | |
- name: Upload Executable as Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: isdb-scanner | |
path: dist/isdb-scanner | |
- name: Build Wheel | |
run: | | |
poetry build | |
- name: Upload Wheel as Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: isdb-scanner-wheel | |
path: dist/isdb_scanner-*.whl | |
build-linux-arm: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: linux/arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Create Dockerfile | |
run: | | |
cat <<EOF > Dockerfile | |
FROM arm64v8/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 | |
- name: Build Docker Image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
tags: arm64v8/ubuntu:build | |
cache-from: type=gha,scope=arm64v8/ubuntu | |
cache-to: type=gha,scope=arm64v8/ubuntu,mode=max | |
load: true | |
- name: Remove Dockerfile | |
run: rm Dockerfile | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Build with PyInstaller | |
run: | | |
docker run --rm -i -v $(pwd):/work -w /work arm64v8/ubuntu:build bash -c \ | |
'poetry install && poetry run pyinstaller --onefile --name=isdb-scanner-arm isdb_scanner/__main__.py' | |
- name: Upload Executable as Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: isdb-scanner-arm | |
path: dist/isdb-scanner-arm | |
# build-linux と build-linux-arm のジョブが完了し、かつタグが push されたときのみ実行 | |
release: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
runs-on: ubuntu-20.04 | |
needs: | |
- build-linux | |
- build-linux-arm | |
permissions: | |
contents: write | |
steps: | |
- name: Download Artifact (x86_64) | |
uses: actions/download-artifact@v3 | |
with: | |
name: isdb-scanner | |
path: dist | |
- name: Download Artifact (arm64) | |
uses: actions/download-artifact@v3 | |
with: | |
name: isdb-scanner-arm | |
path: dist | |
- name: Download Artifact (wheel) | |
uses: actions/download-artifact@v3 | |
with: | |
name: isdb-scanner-wheel | |
path: dist | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
files: | | |
./dist/isdb-scanner | |
./dist/isdb-scanner-arm | |
./dist/isdb_scanner-*.whl |