Skip to content

Release (All)

Release (All) #61

name: Release (Windows)
on:
workflow_dispatch:
inputs:
version:
description: "Version Number (x.y.z)"
required: true
type: string
release:
description: "Create Release?"
required: false
default: false
type: boolean
env:
WIN_TARGET: windows-2019
LINUX_TARGET: linux
MAC_TARGET: macosx
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version || steps.custom.outputs.version || steps.tag.outputs.version }}
steps:
- name: Output Version
id: version
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.version == '' ) }}
run: echo "version=$(date +'%Y%m%d-%H%M')" >> $GITHUB_OUTPUT
- name: Output Custom Version
id: custom
if: ${{ github.event_name == 'workflow_dispatch' && inputs.version != '' }}
run: echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
- name: Output Tag
id: tag
if: ${{ github.event_name == 'push' }}
run: echo "version=$(echo ${GITHUB_REF#refs/*/} | sed -e 's/v//')" >> $GITHUB_OUTPUT
build-windows:
# Windows is currently the only platform this action supports
needs: [version]
runs-on: windows-2019
steps:
# Check-out repository
- uses: actions/checkout@v4
with:
path: build-windows
- name: Install Visual C++ Redistributable
run: |
choco install vcredist2015
# Setup Python
- uses: actions/setup-python@v4
with:
python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
cache: 'pip'
# cache-dependency-path: |
# **/requirements*.txt
# Install dependencies
- name: Install Dependencies
run: |
cd .\build-windows
pip install poetry
poetry config virtualenvs.in-project true
poetry install --no-root
# Uncomment to printout environment paths and python setup
# poetry run python .\python-env.py
# Build zip folder with executable using pyinstaller
- name: Build zip file
run: |
cd .\build-windows
cp .\.github\pyinstaller\gesture-mouse.spec.win gesture-mouse.spec
poetry run pyinstaller.exe gesture-mouse.spec --clean --noconfirm
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: gesture-mouse-${{env.WIN_TARGET}}-${{ needs.version.outputs.version }}
include-hidden-files: true
path: build-windows/dist/gesture-mouse
build-linux:
# Windows is currently the only platform this action supports
needs: [version]
runs-on: ubuntu-20.04
steps:
# Check-out repository
- uses: actions/checkout@v4
with:
path: build-linux
# Setup Python
- uses: actions/setup-python@v4
with:
python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
cache: 'pip'
# cache-dependency-path: |
# **/requirements*.txt
# Install dependencies
- name: Install Dependencies
run: |
cd ./build-linux
#install linux dependencies
sudo apt update -q
sudo apt install -y -q build-essential libgl1-mesa-dev
sudo apt install -y -q libxkbcommon-x11-0
sudo apt install -y -q libxcb-image0
sudo apt install -y -q libxcb-keysyms1
sudo apt install -y -q libxcb-render-util0
sudo apt install -y -q libxcb-xinerama0
sudo apt install -y -q libxcb-icccm4
sudo apt-get install -y libegl1
pip install poetry
poetry config virtualenvs.in-project true
poetry install --no-root
# Uncomment to printout environment paths and python setup
# poetry run python .\python-env.py
# Build zip folder with executable using pyinstaller
- name: Build zip file
run: |
cd ./build-linux
cp ./.github/pyinstaller/gesture-mouse.spec.linux gesture-mouse.spec
poetry run pyinstaller gesture-mouse.spec --clean --noconfirm
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: gesture-mouse-${{env.LINUX_TARGET}}-${{ needs.version.outputs.version }}
include-hidden-files: true
path: build-linux/dist/gesture-mouse
release:
needs: [version, build-windows]
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.release.outputs.upload_url }} # Set job-level output
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true')
steps:
- name: Create Release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.version.outputs.version }}
release_name: Release ${{ needs.version.outputs.version }}
draft: false
prerelease: false
release-upload:
runs-on: ubuntu-latest
needs: [version, build-windows, release]
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
# with:
# name: gesture-mouse-${{ needs.version.outputs.version }}
# path: gesture-mouse-${{ needs.version.outputs.version }}
- name: Display structure of downloaded files
run: |
ls
zip -r gesture-mouse-${{env.WIN_TARGET}}-${{ needs.version.outputs.version }}.zip ./gesture-mouse-${{env.WIN_TARGET}}-${{ needs.version.outputs.version }}/
zip -r gesture-mouse-${{env.LINUX_TARGET}}-${{ needs.version.outputs.version }}.zip ./gesture-mouse-${{env.LINUX_TARGET}}-${{ needs.version.outputs.version }}/
ls
#- name: upload release asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.release.outputs.upload_url }}
# asset_path: ./*.zip
# #asset_name: gesture-mouse-${{ needs.version.outputs.version }}.zip
# asset_content_type: application/zip
- name: Upload Multiple Release Assets
# You may pin to the exact commit or the version.
# uses: NBTX/upload-release-assets@f68d1c91ca950f33ee35514883819c2bb053f487
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: NBTX/upload-release-assets@v1
with:
# The URL for uploading assets to the release
upload_url: ${{ needs.release.outputs.upload_url }}
# A glob of assets to upload
targets: ./*.zip
asset_content_type: application/zip