Skip to content

test windows

test windows #30

Workflow file for this run

name: Build and Release
on:
push:
branches:
- fix-ci
- master
paths:
- 'pyproject.toml'
permissions:
contents: write
actions: write
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Get Version from pyproject.toml
run: |
$version = (Get-Content pyproject.toml | Select-String -Pattern '^version = "(.*)"' | ForEach-Object { $_.Matches.Groups[1].Value })
echo "version=$version" >> $env:GITHUB_ENV
- name: Get Last Commit Version
run: |
$commit_version = (git show HEAD^:pyproject.toml | Select-String -Pattern '^version = "(.*)"' | ForEach-Object { $_.Matches.Groups[1].Value })
if (!$commit_version) { $commit_version = "none" }
echo "last_commit_version=$commit_version" >> $env:GITHUB_ENV
- name: Check if Versions Match
run: |
if ("${{ env.version }}" -eq "${{ env.last_commit_version }}") {
echo "skip_build=true" >> $env:GITHUB_ENV
} else {
echo "skip_build=false" >> $env:GITHUB_ENV
}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
if: env.skip_build != 'true'
- name: Install PDM
run: pip install pdm
if: env.skip_build != 'true'
- name: Install Dependencies
run: |
pdm install
pip install pyinstaller
if: env.skip_build != 'true'
- name: Build Binary with PyInstaller
run: |
$env:PYTHONPATH = ".\.venv\Lib\site-packages"; pyinstaller --name GameYamlSpider `
--add-data "gameyamlspiderandgenerator\plugin:gameyamlspiderandgenerator\plugin" `
--add-data "./.venv/lib/site-packages/language_data/data:language_data\data" `
--add-data ./.venv/lib/site-packages/ruamel/yaml/string/__plug_in__.py:ruamel/yaml/string `
--hidden-import gameyamlspiderandgenerator.plugin.gcores `
--hidden-import gameyamlspiderandgenerator.plugin.itchio `
--hidden-import gameyamlspiderandgenerator.plugin.steam `
--hidden-import yamlgenerator_hook_search `
--hidden-import language_data `
--hidden-import ruamel.yaml.string `
--hidden-import yamlgenerator_hook_validate `
pkg.py
env:
PATH: ${{ github.workspace }}/.pdm/bin:${{ env.PATH }}
if: env.skip_build != 'true'
- name: Package with Zipfile
run: python -m zipfile -c dist\GameYamlSpider.zip dist\GameYamlSpider
if: env.skip_build != 'true'
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Set Is Pre-release
id: prerelease-check
run: |
if [[ "${{ env.version }}" =~ (a|b|dev|rc)$ ]]; then
echo "This is a pre-release version. Skipping GitHub release."
echo "pre_release=true" >> $GITHUB_ENV
else
echo "This is a stable release."
echo "pre_release=false" >> $GITHUB_ENV
fi
- name: Create Release
if: env.pre_release == 'false'
uses: actions/create-release@v1
with:
tag_name: v${{ env.version }}
release_name: Release v${{ env.version }}
draft: false
prerelease: ${{ env.pre_release }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Assets
if: env.pre_release == 'false'
uses: actions/upload-artifact@v4
with:
repo: ${{ github.repository }}
release_id: ${{ steps.create-release.outputs.id }}
asset_path: dist/GameYamlSpider.zip
asset_name: windows-binary-${{ env.version }}.zip
asset_content_type: application/zip