|
| 1 | +name: Build and Release Nuitka Standalone |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + pages: write |
| 11 | + id-token: write |
| 12 | + pull-requests: write |
| 13 | + issues: write |
| 14 | + actions: read |
| 15 | + checks: write |
| 16 | + |
| 17 | +env: |
| 18 | + PACKAGE_VERSION: 0.1.0 |
| 19 | + |
| 20 | +jobs: |
| 21 | + build-and-release: |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + os: [windows-latest, ubuntu-latest, macos-latest] |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout code |
| 29 | + uses: actions/checkout@main |
| 30 | + |
| 31 | + - name: Set up Python |
| 32 | + uses: actions/setup-python@main |
| 33 | + with: |
| 34 | + python-version: "3.12" |
| 35 | + |
| 36 | + - name: Install Nuitka and dependencies |
| 37 | + run: | |
| 38 | + python -m pip install --upgrade pip |
| 39 | + pip install nuitka numpy torch torchaudio transformers huggingface_hub |
| 40 | +
|
| 41 | + - name: Build with Nuitka |
| 42 | + run: python build.py |
| 43 | + |
| 44 | + - name: Get latest tag |
| 45 | + id: get_tag |
| 46 | + shell: bash |
| 47 | + run: | |
| 48 | + latest_tag=$(git tag | sort -V | tail -n 1) |
| 49 | + if [ -z "$latest_tag" ]; then |
| 50 | + new_tag="v${{ env.PACKAGE_VERSION }}" |
| 51 | + else |
| 52 | + random_str=$(openssl rand -hex 4) |
| 53 | + version_prefix=${{ env.PACKAGE_VERSION }} |
| 54 | + new_tag="${version_prefix}-${random_str}" |
| 55 | + fi |
| 56 | + echo "LATEST_TAG=$new_tag" >> $GITHUB_ENV |
| 57 | +
|
| 58 | + - name: Configure git for tagging |
| 59 | + run: | |
| 60 | + git config user.name "github-actions[bot]" |
| 61 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 62 | +
|
| 63 | + - name: Create tag |
| 64 | + run: | |
| 65 | + git tag ${{ env.LATEST_TAG }} |
| 66 | + git push origin ${{ env.LATEST_TAG }} |
| 67 | +
|
| 68 | + - name: Create GitHub release |
| 69 | + id: create_release |
| 70 | + uses: softprops/action-gh-release@c43d7637b9b9ce3e953168c325d27253a5d48d8e |
| 71 | + env: |
| 72 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 73 | + with: |
| 74 | + tag_name: ${{ env.LATEST_TAG }} |
| 75 | + name: v${{ env.PACKAGE_VERSION }} |
| 76 | + body: | |
| 77 | + Release version ${{ env.PACKAGE_VERSION }} of the project. |
| 78 | +
|
| 79 | + - name: Upload Nuitka build artifact |
| 80 | + uses: actions/upload-artifact@main |
| 81 | + with: |
| 82 | + name: nuitka-dist-${{ matrix.os }} |
| 83 | + path: dist/ |
0 commit comments