Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions .github/workflows/pyinstaller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,34 @@ jobs:
initpy-files: ${{ inputs.version-file }}

- name: "Debug Version"
if: ${{ matrix.os == 'windows-latest' }}
continue-on-error: true
shell: bash
run: |
cat ${{ inputs.version-file }}

- name: "Version"
# Note: packaging is not available on macos-latest by default
if: ${{ matrix.os == 'windows-latest' && inputs.windows-file }}
id: version
shell: python
run: |
import os
from packaging.version import Version
version = Version('${{ inputs.version }}')
print(f"{version.base_version=}")
pre_number = version.pre[1] if version.pre else 0
print(f"{pre_number=}")
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
f.write(f"base_version={version.base_version}\n")
f.write(f"pre_number={pre_number}\n")

- name: "Windows Version"
if: ${{ matrix.os == 'windows-latest' && inputs.windows-file }}
env:
version: "${{ steps.version.outputs.base_version }}.${{ steps.version.outputs.pre_number }}"
shell: bash
run: |
uv run pyivf-make_version --source-format yaml \
--metadata-source "${{ inputs.windows-file }}" \
--outfile win-version.txt --version "0.${{ inputs.version }}"
uvx toml-run win-version -- --version "${{ env.version }}"

- name: "Debug Windows Version"
if: ${{ matrix.os == 'windows-latest' }}
Expand All @@ -100,7 +115,7 @@ jobs:
- name: "Build"
shell: bash
run: |
uv run pyinstaller -F -n sharex -i docs/favicon.ico ${{ matrix.extra-args }} ${{ inputs.source-file }}
uvx toml-run pyinstaller -- ${{ matrix.extra-args }}

- name: "List Artifacts"
continue-on-error: true
Expand All @@ -114,20 +129,21 @@ jobs:
md="Artifacts: \`${{ matrix.os }}\`\n\`\`\`text\n${results}\n\`\`\`"
echo -e "${md}" >> "$GITHUB_STEP_SUMMARY"

- name: "Upload to Actions"
if: ${{ github.event_name != 'release' }}
uses: actions/upload-artifact@v5
with:
name: ${{ matrix.name }}
path: dist

- name: "Archive Release"
if: ${{ github.event_name == 'release' }}
uses: thedoctor0/[email protected]
with:
type: zip
directory: dist
filename: "${{ matrix.name }}.zip"

- name: "Upload to Actions"
if: ${{ github.event_name != 'release' }}
uses: actions/upload-artifact@v5
with:
name: ${{ matrix.name }}
path: "dist"

- name: "Upload Release"
if: ${{ github.event_name == 'release' }}
uses: cssnr/upload-release-action@latest
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ __pycache__/
build/
dist/
.*cache/
/.*cache*
.*cache*
*.log
*.pyc
.coverage
coverage.xml
# App
/site/
/test*.*
*.spec
win-version.txt
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ extend-exclude = [".github"]
select = ["E4", "E7", "E9", "F", "B", "Q"]

[tool.scripts]
version = "pyivf-make_version --source-format yaml --metadata-source .github/files/win-version.yaml --outfile win-version.txt"
install = "pyinstaller -F -n npmstat -i docs/favicon.ico src/app.py"
win-version = "uv run pyivf-make_version --source-format yaml --metadata-source .github/files/win-version.yaml --outfile win-version.txt"
pyinstaller = "uv run pyinstaller -F -n npmstat -i docs/favicon.ico src/app.py"
test = ["coverage run -m pytest", "coverage report -m"]
build = "uv run hatch build"
predocs = "rm -rf .cache site"
Expand Down