diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d6b2e2..e952dac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -112,55 +112,71 @@ 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() - "RELEASE_TAG=$tag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - name: Build with pyinstaller - shell: powershell - run: | - micromamba activate eos_build - 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" + + 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() + + Write-Host "Release tag: $tag" + + Add-Content -Path $env:GITHUB_ENV -Value "RELEASE_TAG=$tag" + + - name: Build with pyinstaller + shell: powershell + run: | + Write-Host "Building version: $env:RELEASE_TAG" + + micromamba run -n eos_build pyinstaller windows_build.spec + Copy-Item README.rst dist\eos\ + + - name: Package artifact + shell: powershell + run: | + Compress-Archive -Path dist\eos\* -DestinationPath "amor_eos-win64-$env:RELEASE_TAG.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: |- + amor_eos-win64*.zip