Building for v1.6.1 #21
Workflow file for this run
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: GitHub Actions Build | |
| run-name: Building for ${{ github.ref_name }} | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| jobs: | |
| npm-build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| cache-key: ${{ steps.Store-Cache-Key.outputs.cache-key }} | |
| defaults: | |
| run: | |
| working-directory: ./front | |
| steps: | |
| - name: Check-out repository | |
| uses: actions/checkout@v4 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Install Dependencies | |
| run: npm install | |
| - name: Build Executable | |
| run: npm run build | |
| - name: Store Cache Key | |
| id: Store-Cache-Key | |
| run: echo "cache-key=frontpage-dist-${{ hashFiles('page/**') }}" >> "$GITHUB_OUTPUT" | |
| - name: Cache | |
| uses: actions/cache@v4.2.1 | |
| with: | |
| path: page | |
| key: ${{ steps.Store-Cache-Key.outputs.cache-key }} | |
| build: | |
| env: | |
| UV_INDEX: https://pypi.org/simple | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ macos-latest, ubuntu-latest, windows-latest ] | |
| runs-on: ${{ matrix.os }} | |
| needs: npm-build | |
| steps: | |
| - name: Check-out repository | |
| uses: actions/checkout@v4 | |
| - name: Restore cached frontend artifacts | |
| uses: actions/cache@v4.2.1 | |
| with: | |
| path: page | |
| key: ${{ needs.npm-build.outputs.cache-key }} | |
| enableCrossOsArchive: true | |
| fail-on-cache-miss: true | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: Install Dependencies | |
| run: uv sync --dev | |
| - name: Build Executable | |
| run: uv run python -m nuitka --standalone --windows-console-mode=force --assume-yes-for-downloads --user-package-configuration-file=nuitka-package.config.yml --remove-output --lto=yes --output-dir=build -o MaaXuexi webui.py | |
| - name: Copy Resource Linux Macos | |
| if: ${{ matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest' }} | |
| run: | | |
| cp -r resource build/webui.dist/resource | |
| cp -r config build/webui.dist/config | |
| cp -r page build/webui.dist/page | |
| - name: Copy Resource Windows | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| run: | | |
| del build\webui.dist\maa\bin\DirectML.dll | |
| xcopy .\resource\ build\webui.dist\resource\ /S /I | |
| xcopy .\config\ build\webui.dist\config\ /S /I | |
| xcopy .\page\ build\webui.dist\page\ /S /I | |
| - name: Create Version file | |
| run: echo "${{ github.ref_name }}" >> build/webui.dist/version | |
| - name: Determine OS Name | |
| uses: rishabhgupta/split-by@v1.0.1 | |
| id: split | |
| with: | |
| string: ${{ matrix.os }} | |
| split-by: '-' | |
| - name: Install Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version-file: "updater/go.mod" | |
| - name: Build Updater Windows | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| working-directory: ./updater | |
| run: go build -ldflags "-s -w" -o ../build/webui.dist/Updater.exe | |
| - name: Build Updater Linux Macos | |
| if: ${{ matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest' }} | |
| working-directory: ./updater | |
| run: go build -ldflags "-s -w" -o ../build/webui.dist/Updater | |
| - name: Compress Build | |
| run: 7z a -t7z -mx=9 -mmt -ms -r MaaXuexi-${{ steps.split.outputs._0 }}-${{ github.ref_name }}.7z "./build/webui.dist/*" | |
| - name: Upload Artifacts To Cloudflare | |
| uses: magicwallet/r2-upload@main | |
| with: | |
| endpoint: ${{ secrets.R2_ENDPOINT }} | |
| access_key_id: ${{ secrets.R2_ACCESS_KEY_ID }} | |
| secret_access_key: ${{ secrets.R2_ACCESS_SECRET_KEY }} | |
| bucket: maaxuexi | |
| file: ./MaaXuexi-${{ steps.split.outputs._0 }}-${{ github.ref_name }}.7z | |
| - name: Release | |
| uses: ncipollo/release-action@v1.16.0 | |
| with: | |
| draft: true | |
| allowUpdates: true | |
| artifacts: | | |
| MaaXuexi-${{ steps.split.outputs._0 }}-${{ github.ref_name }}.7z |