Merge pull request #13 from Adrian8115/patch-1 #23
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 (Portable) | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: read-all | |
jobs: | |
build: | |
runs-on: windows-2022 | |
env: | |
WP_URL: https://github.com/winpython/winpython/releases/download/7.5.20240410final/Winpython64-3.12.3.0dot.exe | |
WP_SHA256: beef54eba558559255a73e59ae1986e8d06a6b12b55e78645ab42b4d6974e124 | |
WP_BINARY_DIR: WPy64-31230\python-3.12.3.amd64 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up MSVC | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: x86_64 | |
- name: Set up CMake and Ninja | |
uses: lukka/get-cmake@latest | |
- name: Download Winpython | |
run: | | |
Invoke-WebRequest -OutFile winpython.exe ${{ env.WP_URL }} | |
$file_hash = (Get-FileHash winpython.exe ).Hash | |
if ($file_hash -ne "${{ env.WP_SHA256 }}") { exit(1) } | |
- name: Install Winpython | |
run: .\winpython.exe -y | |
- name: Install Endstone | |
run: ${{ env.WP_BINARY_DIR }}\python.exe -m pip install . | |
- name: Clean Up | |
run: | | |
${{ env.WP_BINARY_DIR }}\python.exe -m pip install pyclean | |
${{ env.WP_BINARY_DIR }}\python.exe -m pyclean ${{ env.WP_BINARY_DIR }} | |
- name: Create Bundle | |
run: | | |
New-Item dist\endstone-win_amd64-portable\bin\python -ItemType Directory | |
Copy-Item -Path ${{ env.WP_BINARY_DIR }}\* -Destination dist\endstone-win_amd64-portable\bin\python -Recurse | |
Copy-Item -Path scripts\start.cmd -Destination dist\endstone-win_amd64-portable | |
Copy-Item -Path CHANGELOG.md -Destination dist\endstone-win_amd64-portable | |
Copy-Item -Path LICENSE -Destination dist\endstone-win_amd64-portable | |
- name: Create Zip | |
run: 7z a endstone-win_amd64-portable.zip .\dist\endstone-win_amd64-portable\* | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: endstone-win_amd64-portable.zip | |
name: endstone-win_amd64-portable.zip | |
release: | |
if: contains(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- name: Restore Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: endstone-* | |
path: dist | |
merge-multiple: true | |
- name: Create a Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: dist/* |