Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/release_windows_zip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: release-windows-zip
on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
build-windows-zip:
runs-on: windows-latest
steps:
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "The name of your tag is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Set up Cygwin
uses: egor-tensin/setup-cygwin@v3
with:
platform: x64
packages: bison flex python3 make clang
- name: Add Environment variables
run: |
echo "GNU_BISON_BIN=C:\tools\cygwin\bin\bison.exe" >> $env:GITHUB_ENV
echo "GNU_FLEX_BIN=C:\tools\cygwin\bin\flex.exe" >> $env:GITHUB_ENV
echo "PYTHON_BIN=C:\tools\cygwin\bin\python3.9.exe" >> $env:GITHUB_ENV
Comment on lines +24 to +28

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid hardcoding Cygwin Python minor version

The workflow hardcodes C:\tools\cygwin\bin\python3.9.exe, but the Cygwin python3 package’s executable name changes when the minor version updates (e.g., python3.10.exe, python3.11.exe). On runners where 3.9 is no longer present, the Version.py step will fail and the release ZIP won’t be produced. Using the unversioned python3.exe (or relying on PATH) would avoid this fragility.

Useful? React with 👍 / 👎.

echo $env:GNU_BISON_BIN
echo $env:GNU_FLEX_BIN
echo $env:PYTHON_BIN
- name: Check out repository code
uses: actions/checkout@v3
- run: echo "The ${{ github.repository }} repository has been cloned to the runner."
- name: Generate Mana version infomation
working-directory: ./compiler
run: ${{env.PYTHON_BIN}} Version.py
- name: Build Mana 64bit compiler
run: msbuild mana.sln /t:build /p:Configuration=Release /p:Platform=x64
- name: Prepare release zip
shell: pwsh
run: |
$stage = Join-Path $env:RUNNER_TEMP "release-stage"
$win64 = Join-Path $stage "Win64"
New-Item -ItemType Directory -Force -Path $win64 | Out-Null
Copy-Item -Path "x64/Release/mana.exe" -Destination (Join-Path $win64 "Mana.exe")
Copy-Item -Path "runner" -Destination (Join-Path $stage "runner") -Recurse
Copy-Item -Path "LICENSE.md" -Destination (Join-Path $stage "LICENSE.md")
$zipPath = Join-Path $env:RUNNER_TEMP "Mana-Windows-Release.zip"
if (Test-Path $zipPath) { Remove-Item $zipPath }
Compress-Archive -Path (Join-Path $stage "*") -DestinationPath $zipPath
"ZIP_PATH=$zipPath" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Upload release asset
uses: softprops/action-gh-release@v1
with:
files: ${{ env.ZIP_PATH }}
Loading