diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 47a49f26..30141b90 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -43,6 +43,11 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Install GNU Softwares + uses: liblaf/template/.github/actions/install@main + with: + brew: coreutils + choco: gnuwin32-coreutils.install - name: Install Task uses: arduino/setup-task@v1 with: @@ -77,8 +82,8 @@ jobs: upload: name: Upload Release Assets needs: - - build-exe - build-pkg + - build-exe if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: @@ -89,5 +94,6 @@ jobs: - name: Upload Release Assets uses: softprops/action-gh-release@master with: - tag_name: dev + prerelease: true files: artifacts/**/* + tag_name: dev diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d9c2e012..49c5d1b6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,8 +13,24 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} jobs: + release: + name: Create GitHub Release + runs-on: ubuntu-latest + outputs: + created: ${{ steps.release.outputs.releases_created }} + tag: ${{ steps.release.outputs.tag_name }} + steps: + - id: release + name: Create GitHub Release + uses: google-github-actions/release-please-action@v4 + with: + release-type: python + build-pkg: name: Build Package + needs: + - release + if: needs.release.outputs.created == 'true' runs-on: ubuntu-latest steps: - name: Checkout @@ -42,10 +58,18 @@ jobs: build-exe: name: Build Executable + needs: + - release + if: needs.release.outputs.created == 'true' runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v4 + - name: Install GNU Softwares + uses: liblaf/template/.github/actions/install@main + with: + brew: coreutils + choco: gnuwin32-coreutils.install - name: Install Task uses: arduino/setup-task@v1 with: @@ -77,19 +101,6 @@ jobs: - "3.11" - "3.12" - release: - name: Create GitHub Release - runs-on: ubuntu-latest - outputs: - created: ${{ steps.release.outputs.releases_created }} - tag: ${{ steps.release.outputs.tag_name }} - steps: - - id: release - name: Create GitHub Release - uses: google-github-actions/release-please-action@v4 - with: - release-type: python - publish: name: Publish to PyPI needs: @@ -120,9 +131,9 @@ jobs: upload: name: Upload Release Assets needs: - - build-exe - - build-pkg - release + - build-pkg + - build-exe if: needs.release.outputs.created == 'true' runs-on: ubuntu-latest steps: @@ -133,5 +144,6 @@ jobs: - name: Upload Release Assets uses: softprops/action-gh-release@master with: - tag_name: ${{ needs.release.outputs.tag }} + prerelease: true files: artifacts/**/* + tag_name: ${{ needs.release.outputs.tag }} diff --git a/Taskfile.yaml b/Taskfile.yaml index 2c03507d..c14ec9b3 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -19,13 +19,7 @@ tasks: dist: cmds: - - cmd: python -m nuitka --standalone --onefile - --output-filename="aic-{{OS}}-{{ARCH}}-py{{.PYTHON_VERSION}}{{exeExt}}" - --output-dir="dist" --remove-output main.py - ignore_error: true - - cmd: pyinstaller --distpath="dist" --onefile - --name="aic-{{OS}}-{{ARCH}}-py{{.PYTHON_VERSION}}" main.py - ignore_error: true + - bash scripts/dist.sh "{{OS}}" "{{ARCH}}" "{{.PYTHON_VERSION}}" "{{exeExt}}" vars: PYTHON_VERSION: sh: python scripts/python_version.py @@ -36,7 +30,7 @@ tasks: setup: cmds: - - micromamba --yes --name="ai-commit-cli" create libpython-static python=3.12 + - micromamba --yes --name="ai-commit-cli" create libpython-static python=3.11 - micromamba --yes --name="ai-commit-cli" run poetry install test: diff --git a/cspell.config.yaml b/cspell.config.yaml index a758ce3f..fd27dc73 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -1,4 +1,5 @@ words: + - choco - cython - dmypy - gomod diff --git a/scripts/dist.sh b/scripts/dist.sh new file mode 100644 index 00000000..5d9707af --- /dev/null +++ b/scripts/dist.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -o errexit +set -o nounset +set -o pipefail + +OS=$1 +ARCH=$2 +PYTHON_VERSION=$3 +exeExt=$4 + +rm --force --recursive --verbose dist +if python -m nuitka --standalone --onefile \ + --output-filename="aic-$OS-$ARCH-py$PYTHON_VERSION$exeExt" \ + --output-dir="dist" --remove-output main.py; then + exit 0 +else + status=$? +fi + +rm --force --recursive --verbose dist +if pyinstaller --distpath="dist" --onefile \ + --name="aic-$OS-$ARCH-py$PYTHON_VERSION" main.py; then + exit 0 +else + status=$? +fi + +exit $status