42 lines
1.1 KiB
YAML
42 lines
1.1 KiB
YAML
on:
|
|
push:
|
|
tags:
|
|
- 'v*.*.*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://code.forgejo.org/actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: https://code.forgejo.org/actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install -r requirements.txt
|
|
pip install pyinstaller
|
|
|
|
- name: Build with PyInstaller
|
|
run: |
|
|
pyinstaller --onefile --console --name TinyWeb app.py
|
|
|
|
- name: Prepare artifact
|
|
run: |
|
|
cp dist/TinyWeb TinyWeb-linux-x64
|
|
chmod +x TinyWeb-linux-x64
|
|
|
|
- name: Upload release
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
run: |
|
|
FILE=TinyWeb-linux-x64
|
|
TAG="${{ github.ref_name }}"
|
|
curl -X POST "${{ forgejo.url }}/api/v1/repos/${{ github.repository }}/releases/$TAG/assets" \
|
|
-H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
|
|
-F "attachment=@$FILE"
|
|
|