Skip to content

Merge pull request #4 from HakaiInstitute/bug-fixes #49

Merge pull request #4 from HakaiInstitute/bug-fixes

Merge pull request #4 from HakaiInstitute/bug-fixes #49

Workflow file for this run

name: Create Release
on:
push:
branches-ignore:
- '**'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+rc[0-9]+'
jobs:
build-binaries:
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
os: [ windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Setup Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.2.2
- name: Get version tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Install Linux dependencies
if: ${{ runner.os == 'Linux' }}
run: >
sudo apt-get install
'^libxcb.*-dev'
libx11-xcb-dev
libglu1-mesa-dev
libxrender-dev
libxi-dev
libxkbcommon-dev
libxkbcommon-x11-dev
- name: Install dependencies
run: |
poetry version ${{ env.tag }}
sed -i "s/0.0.0/${{ env.tag }}/g" las_trx/__init__.py
poetry run pip install --upgrade pip setuptools
poetry install
- name: Build Linux GUI Executable
if: ${{ runner.os == 'Linux' }}
run: >
poetry run pyinstaller
--onefile
--icon="las_trx/resources/las-trx.ico"
--add-data="las_trx/resources/las-trx.ico:resources"
--add-data="las_trx/resources/*.ui:resources"
las_trx/__main__.py
- name: Build Windows GUI Executable
if: ${{ runner.os == 'Windows' }}
run: >
poetry run pyinstaller
--onefile
--windowed
--icon="las_trx\resources\las-trx.ico"
--add-data="las_trx\resources\las-trx.ico;resources"
--add-data="las_trx\resources\*.ui;resources"
las_trx/__main__.py
- name: Archive release artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-dist
path: dist
create-release:
needs: build-binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get tag
id: tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Detect prerelease
id: prerelease
run: |
if echo ${{ env.tag }} | grep -qe '?*.*.*rc*'; then
echo "prerelease=true" >> $GITHUB_ENV
else
echo "prerelease=false" >> $GITHUB_ENV
fi
- name: Download Windows artifacts
uses: actions/download-artifact@v2
with:
name: windows-latest-dist
path: win64-dist
- name: Download Ubuntu artifacts
uses: actions/download-artifact@v2
with:
name: ubuntu-latest-dist
path: linux-dist
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.tag }}
release_name: v${{ env.tag }}
draft: true
prerelease: ${{ env.prerelease }}
- name: Upload Windows GUI assets
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: win64-dist/__main__.exe
asset_name: LAS-TRX-v${{ env.tag }}-win64.exe
asset_content_type: application/octet-stream
- name: Upload Ubuntu GUI assets
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: linux-dist/__main__
asset_name: LAS-TRX-v${{ env.tag }}-linux
asset_content_type: application/octet-stream