build-windows #34
This file contains hidden or 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: build-windows | |
| on: | |
| workflow_dispatch: null | |
| jobs: | |
| build-windows: | |
| name: Build StemRoller for Windows | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| ref: main | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' | |
| - run: npm i -D | |
| - run: npm run download-third-party-apps | |
| - run: npm run build:win | |
| - uses: tyankatsu0105/read-package-version-actions@v1 | |
| id: package-version | |
| - run: Rename-Item dist\win-unpacked -NewName stemroller-${{ steps.package-version.outputs.version }}-win-cuda | |
| - run: Invoke-WebRequest -Uri https://www.7-zip.org/a/7zr.exe -OutFile 7zr.exe | |
| - run: Invoke-WebRequest -Uri https://www.7-zip.org/a/7z2409-x64.exe -OutFile 7zInstaller-x64.exe | |
| - run: .\7zr.exe x "7zInstaller-x64.exe" | |
| - run: move "dist\stemroller-${{ steps.package-version.outputs.version }}-win-cuda" "stemroller-${{ steps.package-version.outputs.version }}-win-cuda" | |
| - run: .\7z.exe a -m0=lzma2 -mmt=on -mx=9 -sfx"7z.sfx" "stemroller-${{ steps.package-version.outputs.version }}-win-cuda.exe" "stemroller-${{ steps.package-version.outputs.version }}-win-cuda" | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - run: python -m pip install --upgrade pip huggingface_hub | |
| - name: Upload artifact to Hugging Face Hub | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| HF_REPO_ID: ${{ vars.HF_REPO_ID || secrets.HF_REPO_ID }} | |
| HF_REPO_TYPE: ${{ vars.HF_REPO_TYPE || secrets.HF_REPO_TYPE }} | |
| run: | | |
| if (-not $env:HF_TOKEN) { throw "HF_TOKEN secret is not set" } | |
| if (-not $env:HF_REPO_ID) { throw "HF_REPO_ID is not set (add Actions variable HF_REPO_ID, or secret HF_REPO_ID)" } | |
| if (-not $env:HF_REPO_TYPE) { $env:HF_REPO_TYPE = "model" } | |
| hf upload $env:HF_REPO_ID "stemroller-${{ steps.package-version.outputs.version }}-win-cuda.exe" "stemroller-${{ steps.package-version.outputs.version }}-win-cuda.exe" --repo-type $env:HF_REPO_TYPE --token $env:HF_TOKEN --commit-message "Upload Windows artifact for ${{ steps.package-version.outputs.version }}" |