Skip to content

Commit

Permalink
ci: add GitHub Actions workflow for building and releasing the applic…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
hydrotho committed Jan 1, 2024
1 parent 82b4f42 commit 7d5fc8a
Showing 1 changed file with 124 additions and 0 deletions.
124 changes: 124 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Build and Release

env:
APP_NAME: COMTool

on:
push:
tags:
- "v*.*.*"

jobs:
hatch-build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'

- name: Install Dependencies
run: pip install build

- name: Build Distribution
run: python -m build

- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
compression-level: 0

- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel
path: dist/*.whl
compression-level: 0

nuitka-build:
strategy:
matrix:
os: [ubuntu-20.04, windows-latest, macos-latest]
include:
- os: ubuntu-20.04
arch: x86_64
platform: linux
ext: tar.gz
- os: windows-latest
arch: x86_64
platform: windows
ext: zip
- os: macos-latest
arch: x86_64
platform: darwin
ext: tar.gz

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'

- name: Install Dependencies
run: pip install .

- name: Build Executable
uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
script-name: src/comtool/__main__.py
onefile: true
output-file: ${{ env.APP_NAME }}

- name: Package Binary
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cd build
7z a ../${{ env.APP_NAME }}-${{ matrix.arch }}-${{ matrix.platform }}.${{ matrix.ext }} ${{ env.APP_NAME }}.exe
else
tar -czvf ${{ env.APP_NAME }}-${{ matrix.arch }}-${{ matrix.platform }}.${{ matrix.ext }} -C build ${{ env.APP_NAME }}
fi
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }} Build
path: ${{ env.APP_NAME }}-${{ matrix.arch }}-${{ matrix.platform }}.${{ matrix.ext }}
compression-level: 0

release:
needs: [hatch-build, nuitka-build]

runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Draft Release
uses: softprops/action-gh-release@v1
with:
draft: true
files: artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 7d5fc8a

Please sign in to comment.