fix:暂时售罄时亦可下单(万一上家美付钱呢?) #59
Workflow file for this run
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 Release | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
pull_request: | |
permissions: | |
contents: write | |
packages: write | |
pull-requests: write | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencies on Ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y portaudio19-dev | |
- name: Install dependencies on macOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew update | |
brew install portaudio | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Poetry | |
uses: abatilo/actions-poetry@v2 | |
- name: Virtual Environment | |
run: | | |
poetry config virtualenvs.create true --local | |
poetry config virtualenvs.in-project true --local | |
- name: Install Dependencies | |
run: poetry install | |
- name: Package | |
run: poetry run pyinstaller --clean --noconfirm --log-level WARN cli.spec | |
- name: Rename Release Files with Tag on Ubuntu/MacOS | |
if: matrix.os != 'windows-latest' | |
run: | | |
tag=${GITHUB_REF#refs/tags/} | |
for file in dist/*; do | |
mv "$file" "dist/${tag}-${file##*/}" | |
done | |
- name: Rename Release Files with Tag on Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
$tag = $env:GITHUB_REF -replace 'refs/tags/', '' | |
Get-ChildItem -Path dist | ForEach-Object { | |
Rename-Item -Path $_.FullName -NewName "$tag-$($_.Name)" | |
} | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: dist/* | |
generate_release_notes: true |