Skip to content

Commit

Permalink
Create workflows for generating windows and linux binaries
Browse files Browse the repository at this point in the history
Merge pull request #35 from amir16yp/main
  • Loading branch information
louis-e authored Aug 16, 2024
2 parents 6cebe5a + 6bc1fd3 commit 1e88970
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and Release for Linux

on:
release:
types: [created] # Triggers only when a release is created

jobs:
build-and-release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Create Executable
uses: Martin005/[email protected]
with:
python_ver: '3.10'
spec: 'pyinst-compile.spec'
requirements: 'requirements.txt'
upload_exe_with_name: 'arnis'
options: '--onefile --name arnis'

- name: Build
run: make build

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist/arnis
asset_name: arnis
asset_content_type: application/octet-stream
45 changes: 45 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and Release for Windows

on:
release:
types: [created] # Triggers only when a release is created

jobs:
build-and-release:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Create Executable
uses: Martin005/[email protected]
with:
python_ver: '3.10'
spec: 'pyinst-compile.spec'
requirements: 'requirements.txt'
upload_exe_with_name: 'arnis.exe'
options: '--onefile --name arnis'

- name: Build
run: make build

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist/arnis.exe
asset_name: arnis.exe
asset_content_type: application/octet-stream
34 changes: 34 additions & 0 deletions pyinst-compile.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- mode: python ; coding: utf-8 -*-
import os
import site

# Locate the site-packages directory
site_packages_path = next(p for p in site.getsitepackages() if 'site-packages' in p)

# Path to the legacy_blocks.json file
legacy_blocks_path = os.path.join(site_packages_path, 'anvil', 'legacy_blocks.json')

block_cipher = None

a = Analysis(['arnis.py'],
pathex=['.'],
binaries=[],
datas=[(legacy_blocks_path, 'anvil')],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='arnis',
debug=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=True )

0 comments on commit 1e88970

Please sign in to comment.