Skip to content

Add actions (#9)

Add actions (#9) #14

Workflow file for this run

name: Jaba build
on:
push:
paths:
- '.github/**.yml'
- '**.py'
- '**.png'
- 'requirements.txt'
- '**.omegapog_map_file_type_MLG_1337_228_100500_69_420'
- 'VERSION'
pull_request:
types: [opened]
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: true
matrix:
os: [ubuntu-20.04, ubuntu-22.04, windows-2022]
runs-on: ${{matrix.os}}
name: ${{matrix.os}} Build
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install pygame dependencies
run: >
sudo apt update &&
sudo apt install -y
libsdl2-dev
libsdl2-image-dev
libsdl2-mixer-dev
libsdl2-ttf-dev
libfreetype6-dev
libportmidi-dev
libjpeg-dev
python3-dev
if: runner.os == 'Linux'
- name: Install pyinstaller
run: python -m pip install pyinstaller
- name: Install compiler
run: >
Invoke-WebRequest -UseBasicParsing -Uri https://aka.ms/vs/17/release/vs_BuildTools.exe
-OutFile .\vs_BuildTools.exe &&
Start-Process -Wait .\vs_BuildTools.exe -ArgumentList
"--quiet", "--nocache", "--wait", "--norestart", "--add",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
if: runner.os == 'Windows'
- name: Build С and install dependencies
run: pip install -v .
- name: Pack into EXE
run: >
pyinstaller -y -w --contents-directory .
--add-data "lang:lang"
--add-data "map_levels:map_levels"
--add-data "fonts:fonts"
--add-data "sprites:sprites"
--add-data "palettes:palettes"
--add-data "jaba_is_logo.png:."
--add-data "saves:saves"
--add-data "levels:levels"
main.py
- name: Create tarball # We are creating tar because of .so soft links to pygame.libs
if: runner.os == 'Linux'
run: tar cf ../../build.tar *
working-directory: ./dist/main
- name: Create archive
if: runner.os != 'Linux'
run: Compress-Archive -Path * -DestinationPath ../../build.zip
working-directory: ./dist/main
- name: Send Linux ${{matrix.os}} artifact
uses: actions/upload-artifact@v4
if: runner.os == 'Linux'
with:
name: build-${{matrix.os}}
path: build.tar
- name: Send Windows artifact
uses: actions/upload-artifact@v4
if: runner.os != 'Linux'
with:
name: build-windows
path: build.zip
release:
runs-on: ubuntu-22.04
needs: build
if: ${{ github.ref_name == 'main' }}
steps:
- uses: actions/checkout@v4
- name: Check for version
id: version
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
- name: Download an artifacts
uses: actions/download-artifact@v4
- name: Reorganize artifacts
run: >
for d in build*/; do
f=("$d"*); # array variable that will store the file names in each directory
ext="${f[0]##*.}"; # extracting extension first file in folder
fname="${d%/}"; # Removing trailing slash
mv "${f[0]}" "${fname}.${ext}";
rmdir "$d";
done
- name: Release
uses: softprops/action-gh-release@v2
with:
files: build*
name: ${{ steps.version.outputs.version }}
tag_name: ${{ steps.version.outputs.version }}