Build sb binary #143
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 sb binary | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- '*.py' | |
- 'requirements/**' | |
tags: | |
- '*' | |
pull_request: | |
paths: | |
- '*.py' | |
- 'requirements/**' | |
permissions: | |
contents: write | |
actions: write | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- name: Check-out repository | |
uses: actions/checkout@v4 | |
- name: Setup venv | |
run: python3.12 -m venv venv | |
- name: Install Dependencies | |
run: ./venv/bin/pip install --disable-pip-version-check -r requirements/requirements.txt | |
- name: List Pip modules | |
run: ./venv/bin/pip list | |
- name: Prepare script with version | |
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' | |
run: | | |
echo "Building with version ${GITHUB_REF#refs/tags/}" | |
sed -i "s/__version__ = \"0.0.0\"/__version__ = \"${GITHUB_REF#refs/tags/}\"/" sb.py | |
- name: Compile binary | |
run: ./venv/bin/python -m nuitka sb.py --onefile -o sb && chmod +x sb | |
- name: Upload artifact | |
if: startsWith(github.ref, 'refs/tags/') != true | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sb | |
path: sb | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' | |
with: | |
files: | | |
sb | |
- name: Run release workflow | |
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' | |
run: gh workflow run release.yml -f release_tag=${{ github.ref }} | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- uses: sarisia/actions-status-discord@v1 | |
if: always() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} |