|
| 1 | +# .github/workflows/build-release.yml |
| 2 | +name: Build Release |
| 3 | + |
| 4 | +on: |
| 5 | + release: |
| 6 | + types: [published] |
| 7 | + |
| 8 | + push: |
| 9 | + branches: [main] |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ${{matrix.os}} |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + os: [ubuntu-latest, windows-latest] |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Set up Python |
| 23 | + uses: actions/setup-python@v4 |
| 24 | + with: |
| 25 | + python-version: '3.12' |
| 26 | + |
| 27 | + - name: Install dependencies |
| 28 | + run: | |
| 29 | + pip install nuitka json5 |
| 30 | + python -m pip install --upgrade pip |
| 31 | + |
| 32 | + - name: Build with Nuitka |
| 33 | + run: | |
| 34 | + cd src |
| 35 | + python -m nuitka --standalone \ |
| 36 | + --output-filename=fancyfetch \ |
| 37 | + --output-dir=dist \ |
| 38 | + --include-module=setup \ |
| 39 | + --include-module=constants \ |
| 40 | + --include-module=formatting \ |
| 41 | + --include-module=shared \ |
| 42 | + --include-module=configurationhandler \ |
| 43 | + --nofollow-import-to=src.defaults \ |
| 44 | + --assume-yes-for-downloads \ |
| 45 | + main.py |
| 46 | + shell: bash |
| 47 | + |
| 48 | + - name: Copy defaults directory |
| 49 | + run: | |
| 50 | + cp -r src/defaults src/dist/main.dist/defaults |
| 51 | + shell: bash |
| 52 | + |
| 53 | + - name: Create archive (Linux/Mac) |
| 54 | + if: runner.os != 'Windows' |
| 55 | + run: | |
| 56 | + cd src/dist |
| 57 | + tar -czf fancyfetch-${{runner.os}}.tar.gz main.dist/ |
| 58 | + mv fancyfetch-${{runner.os}}.tar.gz ../../ |
| 59 | + |
| 60 | + - name: Create archive (Windows) |
| 61 | + if: runner.os == 'Windows' |
| 62 | + run: | |
| 63 | + cd src/dist |
| 64 | + 7z a fancyfetch-Windows.zip main.dist/ |
| 65 | + move fancyfetch-Windows.zip ../../ |
| 66 | + shell: cmd |
| 67 | + |
| 68 | + - name: Upload build artifacts |
| 69 | + uses: actions/upload-artifact@v4 |
| 70 | + with: |
| 71 | + name: fancyfetch-${{runner.os}} |
| 72 | + path: | |
| 73 | + fancyfetch-*.tar.gz |
| 74 | + fancyfetch-*.zip |
| 75 | + retention-days: 30 |
| 76 | + |
| 77 | + - name: Upload to release (on release only) |
| 78 | + if: github.event_name == 'release' |
| 79 | + uses: softprops/action-gh-release@v1 |
| 80 | + with: |
| 81 | + files: | |
| 82 | + fancyfetch-*.tar.gz |
| 83 | + fancyfetch-*.zip |
| 84 | + env: |
| 85 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
0 commit comments