Windows #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12.5' | |
- name: Create virtual environment | |
run: | | |
python -m venv venv | |
shell: pwsh | |
- name: Activate virtual environment and install dependencies | |
run: | | |
.\venv\Scripts\Activate | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
# pip install --upgrade cx_Freeze | |
pip install --force --no-cache --pre --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze | |
shell: pwsh | |
- name: Build MSI | |
run: | | |
.\venv\Scripts\Activate | |
cd src | |
python build.py bdist_msi | |
shell: pwsh | |
- name: Get App Info | |
id: get_version | |
run: | | |
.\venv\Scripts\Activate | |
$version = (Get-Content src/settings.py | Select-String -Pattern 'BUILD_VERSION\s*=\s*"([^"]+)"').Matches.Groups[1].Value | |
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
$filename = (Get-ChildItem -Path src/dist/out/*.msi).Name | |
echo "FILENAME=$filename" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
shell: pwsh | |
- name: Create Tag | |
id: create_tag | |
run: | | |
.\venv\Scripts\Activate | |
$tagExists = git tag -l $env:VERSION | |
if ($tagExists -eq "") { | |
git tag $env:VERSION | |
if ($LASTEXITCODE -ne 0) { | |
Write-Error "Failed to create tag $env:VERSION" | |
exit 1 | |
} | |
git push origin $env:VERSION | |
if ($LASTEXITCODE -ne 0) { | |
Write-Error "Failed to push tag $env:VERSION" | |
exit 1 | |
} | |
} else { | |
Write-Host "Tag $env:VERSION already exists, skipping tag creation" | |
} | |
shell: pwsh | |
- name: Fetch all tags | |
run: git fetch --tags | |
shell: pwsh | |
- name: Create Changelog | |
id: changelog | |
uses: loopwerk/tag-changelog@v1.3.0 | |
with: | |
token: ${{ secrets.PAT }} | |
- name: Generate Checksum | |
run: | | |
.\venv\Scripts\Activate | |
$checksum = Get-FileHash src/dist/out/*.msi -Algorithm SHA256 | |
$filename = [System.IO.Path]::GetFileName($checksum.Path) | |
"$($checksum.Hash) $filename" > src/dist/out/checksums.txt | |
shell: pwsh | |
- name: Upload YASB Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: msi-artifact | |
path: src/dist/out/*.msi | |
- name: Upload Checksum Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: checksum-artifact | |
path: src/dist/out/checksums.txt | |
- name: Create and Upload Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: v${{ env.VERSION }} | |
name: Release v${{ env.VERSION }} | |
body: | | |
${{ steps.changelog.outputs.changes }} | |
append_body: true | |
files: | | |
src/dist/out/*.msi | |
src/dist/out/checksums.txt | |
prerelease: false | |
generate_release_notes: true | |
draft: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} |