refactor windows build, variable handling and python env handling. run vs activate and use the var github_env variable in a subsequent step.

Signed-off-by: Basil Bruhn <basil.bruhn@psi.ch>
This commit is contained in:
2026-03-17 15:21:46 +01:00
parent 39d234fbfc
commit 04244c129f
+61 -53
View File
@@ -112,59 +112,67 @@ jobs:
if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all", "windows", "all_incl_release"]'), github.event.inputs.build-items)) }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Ensure build environment
shell: powershell
run: |
$envName="eos_build"
$envFile="conda_windows.yml"
$hashFile="$env:TEMP\$envName.hash"
- uses: actions/checkout@v4
$newHash = (Get-FileHash $envFile).Hash
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
if (!(Test-Path $hashFile)) {
$rebuild = $true
} else {
$oldHash = Get-Content $hashFile
$rebuild = $oldHash -ne $newHash
}
- name: Ensure build environment
shell: powershell
run: |
$envName = "eos_build"
$envFile = "conda_windows.yml"
$hashFile = "$env:TEMP\$envName.hash"
if ($rebuild) {
Write-Host "Environment changed → rebuilding"
if (micromamba env list | Select-String $envName) {
micromamba env remove -n $envName -y 2>$null
}
micromamba create -n $envName -f $envFile -y
$newHash | Out-File $hashFile
} else {
Write-Host "Environment unchanged → using cached env"
}
- name: Determine release tag
shell: powershell
run: |
$tag = micromamba run -n eos_build python -c "import eos; print('v'+eos.__version__)"
$tag = $tag.Trim()
echo "Release tag extracted: $tag"
"RELEASE_TAG=$tag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "File written to: $env:GITHUB_ENV"
- name: Build with pyinstaller
shell: powershell
run: |
echo "Transferred tag: $RELEASE_TAG or ${{ env.RELEASE_TAG }}."
micromamba activate eos_build
echo "Transferred tag: $RELEASE_TAG or ${{ env.RELEASE_TAG }}."
#pyinstaller windows_build.spec
#cd dist\eos
#Compress-Archive -Path .\* -Destination ..\..\eos.zip
- name: Update Release
if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all_incl_release"]'), github.event.inputs.build-items)) }}
uses: actions/gitea-release-action@v1
with:
name: "Amor-Eos ${{ env.RELEASE_TAG }}"
tag_name: "${{ env.RELEASE_TAG }}"
files: |-
eos.zip
$newHash = (Get-FileHash $envFile).Hash
if (!(Test-Path $hashFile)) {
$rebuild = $true
} else {
$oldHash = Get-Content $hashFile
$rebuild = $oldHash -ne $newHash
}
if ($rebuild) {
Write-Host "Environment changed → rebuilding"
micromamba env remove -n $envName -y 2>$null
micromamba create -n $envName -f $envFile -y
$newHash | Out-File $hashFile
} else {
Write-Host "Environment unchanged → using cached env"
}
- name: Determine release tag
shell: powershell
run: |
$tag = micromamba run -n eos_build python -c "import eos; print('v'+eos.__version__)"
$tag = $tag.Trim()
Write-Host "Release tag: $tag"
"RELEASE_TAG=$tag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build with pyinstaller
shell: powershell
run: |
Write-Host "Building version: $env:RELEASE_TAG"
micromamba run -n eos_build pyinstaller windows_build.spec
- name: Package artifact
shell: powershell
run: |
Compress-Archive -Path dist\eos\* -DestinationPath eos.zip
- name: Update Release
if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all_incl_release"]'), github.event.inputs.build-items)) }}
uses: actions/gitea-release-action@v1
with:
name: "Amor-Eos ${{ env.RELEASE_TAG }}"
tag_name: "${{ env.RELEASE_TAG }}"
files: eos.zip