Skip to content

Commit 582834e

Browse files
brittanyrjonesBrittany Jones
andauthored
building instead of downloading artifact (#80)
* building instead of downloading artifact --------- Co-authored-by: Brittany Jones <[email protected]>
1 parent f908d06 commit 582834e

File tree

3 files changed

+40
-32
lines changed

3 files changed

+40
-32
lines changed

.github/workflows/publish.yml

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,35 @@ jobs:
3333
id-token: write # IMPORTANT: this permission is mandatory for Trusted Publishing
3434
steps:
3535
- uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
3638

37-
- name: Get latest build workflow run
38-
id: get_workflow
39-
env:
40-
GH_TOKEN: ${{ github.token }}
39+
- name: Get the latest tag
40+
id: get_tag
4141
run: |
42-
# Get the most recent successful build workflow run for this commit
43-
RUN_ID=$(gh run list --workflow "test-lint-build.yml" --branch main --json databaseId,conclusion,headSha --jq ".[] | select(.headSha == \"${{ github.sha }}\" and .conclusion == \"success\") | .databaseId" | head -n 1)
44-
45-
if [ -z "$RUN_ID" ]; then
46-
echo "No successful build found for commit ${{ github.sha }}"
47-
exit 1
48-
fi
49-
50-
echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT
51-
echo "Found build workflow run: $RUN_ID"
42+
TAG=$(git describe --tags --abbrev=0)
43+
echo "tag=$TAG" >> $GITHUB_OUTPUT
44+
echo "Using tag: $TAG"
5245
53-
- name: Download build artifacts
54-
env:
55-
GH_TOKEN: ${{ github.token }}
46+
- name: Checkout the tagged version
5647
run: |
57-
mkdir -p dist
58-
gh run download ${{ steps.get_workflow.outputs.run_id }} --name release-artifacts-main --dir dist/
48+
git checkout ${{ steps.get_tag.outputs.tag }}
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v4
52+
with:
53+
python-version: "3.11"
54+
55+
- name: Install uv
56+
uses: astral-sh/setup-uv@v5
57+
with:
58+
cache-dependency-glob: pyproject.toml
59+
60+
- name: Install dependencies
61+
run: uv sync --all-extras
62+
63+
- name: Build package
64+
run: uv build
5965

6066
- name: Release to PyPI
6167
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/tag-and-release.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,21 @@ jobs:
2424
fetch-depth: 0
2525
token: ${{ secrets.GITHUB_TOKEN }}
2626

27-
- name: Download artifact using GitHub CLI
28-
env:
29-
GH_TOKEN: ${{ github.token }}
30-
run: |
31-
mkdir -p dist
32-
gh run download ${{ github.event.workflow_run.id }} --name release-artifacts-main --dir dist/
27+
- name: Set up Python
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: "3.11"
31+
32+
- name: Install uv
33+
uses: astral-sh/setup-uv@v5
34+
with:
35+
cache-dependency-glob: pyproject.toml
36+
37+
- name: Install dependencies
38+
run: uv sync --all-extras
39+
40+
- name: Build package
41+
run: uv build
3342

3443
- name: Extract version from branch name
3544
id: version

.github/workflows/test-lint-build.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,3 @@ jobs:
6262
- name: Build package
6363
run: uv build
6464

65-
- name: Upload artifacts for release
66-
if: ${{ matrix.python-version == steps.pyproject-version.outputs.version && github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'release-v') }}
67-
uses: actions/upload-artifact@v4
68-
with:
69-
name: ${{ github.ref_name }}
70-
path: dist/
71-
retention-days: 90

0 commit comments

Comments
 (0)