Skip to content

📦 Package

📦 Package #39

Workflow file for this run

name: 📦 Package
on:
# Triggers the workflow on push or pull request events but only for the master branch
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
releaseTag:
description: 'Release Tag'
required: true
default: 'v2.x.x[a-z]'
releaseName:
description: 'Release Name'
required: true
default: '2.x.x'
releaseBody:
description: 'Release Body'
required: true
default: 'Enjoy.'
jobs:
build-on-platform:
name: Package on ${{ matrix.version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-2022
version: win_x64
pythonArch: 'x64'
- os: windows-2022
version: win_x86
pythonArch: 'x86'
- os: macos-12
version: mac_intel
pythonArch: 'x64'
- os: ubuntu-22.04
version: ubuntu_x64
pythonArch: 'x64'
steps:
- uses: actions/checkout@v4
- name: Classify files, prepare to be packaged
run: |
mkdir ./.pkg/code
mkdir ./.pkg/public
cp -r ./altfe/ ./.pkg/code/altfe/
cp -r ./app/ ./.pkg/code/app/
cp ./main.py ./.pkg/code/
cp -r ./usr/ ./.pkg/public/usr/
cp ./app/config/biu_default.yml ./.pkg/public/config.yml
cp ./LICENSE ./.pkg/public/
cp ./README.md ./.pkg/public/
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.7'
architecture: ${{ matrix.pythonArch }}
- name: Install Requirements
run: |
pip install -r ./requirements.txt
pip install pyinstaller
- name: Run py-pkger.py
run: |
cd ./.pkg/
python ./py-pkger.py auto
- name: Compress to ZIP (win)
if: ${{ contains(matrix.version, 'win') }}
run: |
cd ./.pkg/dist/
mv ./main.exe ./PixivBiu.exe
Compress-Archive * ../../${{ matrix.version }}.zip
- name: Compress to ZIP (unix-like)
if: ${{ contains(matrix.version, 'mac') || contains(matrix.version, 'ubuntu') }}
run: |
cd ./.pkg/dist/
mv ./main ./PixivBiu
zip -r ../../${{ matrix.version }}.zip *
- name: Upload to Artifact
uses: actions/upload-artifact@v3
with:
name: pixivbiuArt
path: ./${{ matrix.version }}.zip
Release:
needs: [build-on-platform]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Download from Artifact
uses: actions/download-artifact@v3
with:
name: pixivbiuArt
- name: Rename
run: |
mv ./win_x64.zip ./PixivBiu_${{ github.event.inputs.releaseTag }}_win_x64.zip
mv ./win_x86.zip ./PixivBiu_${{ github.event.inputs.releaseTag }}_win_x86.zip
mv ./mac_intel.zip ./PixivBiu_${{ github.event.inputs.releaseTag }}_mac_intel.zip
mv ./ubuntu_x64.zip ./PixivBiu_${{ github.event.inputs.releaseTag }}_ubuntu_x64.zip
- name: Release and Done
uses: ncipollo/release-action@v1
with:
artifacts: "PixivBiu_${{ github.event.inputs.releaseTag }}_win_x64.zip, PixivBiu_${{ github.event.inputs.releaseTag }}_win_x86.zip, PixivBiu_${{ github.event.inputs.releaseTag }}_mac_intel.zip, PixivBiu_${{ github.event.inputs.releaseTag }}_ubuntu_x64.zip"
tag: ${{ github.event.inputs.releaseTag }}
name: ${{ github.event.inputs.releaseName }}
body: ${{ github.event.inputs.releaseBody }}
token: ${{ secrets.GITHUB_TOKEN }}