pferd/.github/workflows/build-and-release.yml

79 lines
1.8 KiB
YAML
Raw Normal View History

2021-05-24 15:43:53 +02:00
name: build-and-release
on: push
defaults:
run:
shell: bash
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
2022-04-27 22:16:47 +02:00
python: ["3.9"]
2021-05-24 15:43:53 +02:00
steps:
2023-03-22 00:08:19 +01:00
- uses: actions/checkout@v3
2021-05-24 15:43:53 +02:00
2023-03-22 00:08:19 +01:00
- uses: actions/setup-python@v4
2021-05-24 15:43:53 +02:00
with:
python-version: ${{ matrix.python }}
- name: Set up project
if: matrix.os != 'windows-latest'
run: ./scripts/setup
- name: Set up project on windows
if: matrix.os == 'windows-latest'
# For some reason, `pip install --upgrade pip` doesn't work on
# 'windows-latest'. The installed pip version works fine however.
run: ./scripts/setup --no-pip
- name: Run checks
run: ./scripts/check
- name: Build
run: ./scripts/build
- name: Rename binary
# Glob in source location because on windows pyinstaller creates a file
# named "pferd.exe"
run: mv dist/pferd* dist/pferd-${{ matrix.os }}
- name: Upload binary
2023-03-22 00:08:19 +01:00
uses: actions/upload-artifact@v3
2021-05-24 15:43:53 +02:00
with:
name: Binaries
path: dist/pferd-${{ matrix.os }}
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: build
steps:
- name: Download binaries
2023-03-22 00:08:19 +01:00
uses: actions/download-artifact@v3
2021-05-24 15:43:53 +02:00
with:
name: Binaries
- name: Rename binaries
run: |
mv pferd-ubuntu-latest pferd-linux
mv pferd-windows-latest pferd-windows.exe
mv pferd-macos-latest pferd-mac
- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
pferd-linux
pferd-windows.exe
pferd-mac