Release #21
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: Release | |
| on: | |
| workflow_dispatch: | |
| env: | |
| GITHUB_ACTIONS: true | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| DATE: ${{ steps.get_date.outputs.DATE }} | |
| steps: | |
| - name: Get current date | |
| id: get_date | |
| run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
| build: | |
| strategy: | |
| matrix: | |
| os-version: ["windows-latest", "macos-14"] | |
| python-version: ["3.11"] | |
| poetry-version: ["1.8.3"] | |
| runs-on: ${{ matrix.os-version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: abatilo/actions-poetry@v3 | |
| with: | |
| poetry-version: ${{ matrix.poetry-version }} | |
| - name: Install dependencies | |
| run: | | |
| pip install numpy==1.26.4 | |
| pip install opencv-python==4.10.0.84 | |
| pip install ccrestoration | |
| pip install PyYAML pydantic loguru | |
| - name: Install PyTorch on Windows | |
| if: matrix.os-version == 'windows-latest' | |
| run: | | |
| pip install torch==2.7.1 torchvision==0.22.1 --index-url https://download.pytorch.org/whl/cu128 | |
| - name: Install PyTorch on non-Windows | |
| if: matrix.os-version != 'windows-latest' | |
| run: | | |
| pip install torch==2.7.1 torchvision==0.22.1 | |
| - name: Build | |
| run: | | |
| pip install pyinstaller~=6.14.2 | |
| make gen | |
| make gen-ts | |
| make pyinstaller | |
| - name: zip-windows | |
| if: matrix.os-version == 'windows-latest' | |
| run: | | |
| cd dist\Final2x-core | |
| 7z a -r Final2x-core-windows-x64.7z * | |
| - name: zip-macos-arm64 | |
| if: matrix.os-version == 'macos-14' | |
| run: | | |
| cd dist/Final2x-core | |
| 7z a -r Final2x-core-macos-arm64.7z * | |
| - name: upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Final2x-core-${{ matrix.os-version }} | |
| path: dist/Final2x-core/*.7z | |
| github: | |
| needs: [setup, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: asset | |
| - name: Flatten asset directory | |
| run: | | |
| tree asset | |
| mkdir dist | |
| find asset -type f -print0 | xargs -0 -I{} cp "{}" dist/ | |
| cd dist && ls -l | |
| - name: Create Release and Upload Release Asset | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: Release ${{ needs.setup.outputs.DATE }} | |
| tag_name: ${{ needs.setup.outputs.DATE }} | |
| files: dist/* | |
| pypi: | |
| needs: [github] | |
| strategy: | |
| matrix: | |
| python-version: ["3.11"] | |
| poetry-version: ["1.8.3"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: abatilo/actions-poetry@v3 | |
| with: | |
| poetry-version: ${{ matrix.poetry-version }} | |
| - name: Build package | |
| run: | | |
| make build | |
| - name: Publish a Python distribution to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API }} |