Build #23
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 | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pdm-project/setup-pdm@v4 | |
with: | |
cache: true | |
- name: Build | |
run: pdm build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/* | |
if-no-files-found: error | |
pyinstaller: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-13, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pyinstaller | |
- name: Package using pyinstaller | |
run: pyinstaller -Fn batchlink src/batchlink/cli.py | |
- name: Rename for Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: mv dist/batchlink dist/batchlink-linux64 | |
- name: Rename for Windows | |
if: matrix.os == 'windows-latest' | |
run: mv dist/batchlink.exe dist/batchlink-win64.exe | |
- name: Rename for macOS | |
if: startsWith(matrix.os, 'macos') | |
run: mv dist/batchlink dist/batchlink-macos-$(uname -m) | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.os }} | |
path: dist/* | |
if-no-files-found: error | |
release: | |
runs-on: ubuntu-latest | |
environment: release | |
needs: [build, pyinstaller] | |
permissions: | |
contents: write | |
id-token: write | |
if: startswith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cut the latest release changelog | |
run: | | |
sed -n -i '' '1,/^## /p' CHANGELOG.md | |
sed -i -e '/^## /d' -e 's/^#//' CHANGELOG.md | |
- uses: pdm-project/setup-pdm@v4 | |
- uses: actions/download-artifact@v4 | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: dist*/* | |
body_path: CHANGELOG.md | |
generate_release_notes: true | |
draft: ${{ contains(github.ref, 'draft') }} | |
prerelease: ${{ contains(github.ref, 'prerelease') }} | |
- name: Publish to PyPI | |
if: ${{ ! (contains(github.ref, 'draft') || contains(github.ref, 'prerelease')) }} | |
run: pdm publish --no-build |