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: 25 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ jobs:
build:
runs-on: ubuntu-latest
outputs:
artifact-id: ${{ steps.artifact-upload-step.outputs.artifact-id }}
whl-artifact-id: ${{ steps.artifact-whl-upload-step.outputs.artifact-id }}
pex-artifact-id: ${{ steps.artifact-pex-upload-step.outputs.artifact-id }}
steps:
- uses: actions/checkout@v4
- name: Install uv
Expand All @@ -18,15 +19,24 @@ jobs:
run: uv python install
- name: Build
run: make build
- name: Add PR number
- name: Read the asset list
id: build-asset-list
run: |
cd dist/
echo "WHL_NAME=$(ls *whl)" >> $GITHUB_ENV
echo "PEX_NAME=$(ls *pex)" >> $GITHUB_ENV
- uses: actions/upload-artifact@v6
id: artifact-whl-upload-step
if: github.event_name == 'pull_request'
run: echo ${{ github.event.pull_request.number }} > dist/PR_NUMBER.txt
with:
name: ${{ env.WHL_NAME }}
path: dist/*.whl
- uses: actions/upload-artifact@v6
id: artifact-upload-step
id: artifact-pex-upload-step
if: github.event_name == 'pull_request'
with:
name: build_${{ github.event.pull_request.number }}
path: dist
name: ${{ env.PEX_NAME }}
path: dist/*.pex

comment-pr:
runs-on: ubuntu-latest
Expand All @@ -39,24 +49,24 @@ jobs:
- name: Download build artifacts
uses: actions/download-artifact@v7
with:
artifact-ids: ${{ needs.build.outputs.artifact-id }}
path: build_output
artifact-ids: ${{ needs.build.outputs.pex-artifact-id }},${{ needs.build.outputs.whl-artifact-id }}

- name: Read the asset list
id: asset-list
run: |
echo "WHL_CHECKSUM='$(sha256sum build_output/*whl)'" >> $GITHUB_ENV
echo "PEX_CHECKSUM='$(sha256sum build_output/*pex)'" >> $GITHUB_ENV
echo "WHL_NAME=$(ls *whl)" >> $GITHUB_ENV
echo "WHL_CHECKSUM=$(sha256sum *whl | cut -d '' -f 1)" >> $GITHUB_ENV
echo "PEX_NAME=$(ls *pex)" >> $GITHUB_ENV
echo "PEX_CHECKSUM=$(sha256sum *pex | cut -d '' -f 1)" >> $GITHUB_ENV

- name: Create PR comment with asset link
uses: thollander/actions-comment-pull-request@v3
with:
message: |
🎉 **Build Assets are ready!**

You can download the artifacts from the [build run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).
```
${{ env.WHL_CHECKSUM }}
${{ env.PEX_CHECKSUM }}
```
| File | Checksum |
| --- | --- |
| [${{ env.WHL_NAME }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ needs.build.outputs.whl-artifact-id }}) | `${{ env.WHL_CHECKSUM }}` |
| [${{ env.PEX_NAME }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ needs.build.outputs.pex-artifact-id }}) | `${{ env.PEX_CHECKSUM }}` |
comment-tag: build-assets
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: release.yml
on:

jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/gh-worktree
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python
run: uv python install
- name: Build
run: make build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,19 @@ testpaths = ["tests"]
[tool.flake8]
max-line-length = 100
max-complexity = 10

[tool.uv.build-backend]
source-exclude = [
".envrc",
".idea/",
".git/",
"dist/"
]
wheel-exclude = [
".github/",
".gitignore/",
".precommit-config.yaml",
".venv/",
"Makefile",
"tests/"
]