Skip to content

Commit

Permalink
Update publish workflow (#3)
Browse files Browse the repository at this point in the history
* wip

* wip

* wip
  • Loading branch information
will-ockmore authored Jan 26, 2025
1 parent c370a1b commit 2510918
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 23 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: "ubuntu-latest"

environment:
name: deploy
name: release

steps:
- uses: "actions/checkout@v4"
Expand All @@ -25,10 +25,11 @@ jobs:
python-version: 3.9
uv-version: "0.5.22"

- name: "Install dependencies"
run: uv sync --all-extras --dev

- name: "Build package & docs"
run: "scripts/build"

- name: "Publish to PyPI & deploy docs"
run: "scripts/publish"
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ dmypy.json

# Editor configuration
.vscode/

# Build artifacts
httpx_retries.egg-info/
site/
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Will Ockmore
Copyright (c) 2024 William Ockmore

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
<a href="https://github.com/will-ockmore/httpx-retry/actions">
<img src="https://github.com/will-ockmore/httpx-retry/workflows/Test%20Suite/badge.svg" alt="Test Suite">
</a>
<!-- TODO: Enable after package publish -->
<!-- <a href="https://pypi.org/project/httpx/"> -->
<!-- <img src="https://badge.fury.io/py/httpx.svg" alt="Package version"> -->
<!-- </a> -->
<a href="https://pypi.org/project/httpx-retries/">
<img src="https://badge.fury.io/py/httpx-retries.svg" alt="Package version">
</a>
</p>

<!-- badges-end -->
Expand Down
7 changes: 3 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
<a href="https://github.com/will-ockmore/httpx-retry/actions">
<img src="https://github.com/will-ockmore/httpx-retry/workflows/Test%20Suite/badge.svg" alt="Test Suite">
</a>
<!-- TODO: Enable after package publish -->
<!-- <a href="https://pypi.org/project/httpx/"> -->
<!-- <img src="https://badge.fury.io/py/httpx.svg" alt="Package version"> -->
<!-- </a> -->
<a href="https://pypi.org/project/httpx-retries/">
<img src="https://badge.fury.io/py/httpx-retries.svg" alt="Package version">
</a>
</p>

<em>A retry layer for HTTPX.</em>
Expand Down
21 changes: 10 additions & 11 deletions scripts/publish
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

set -euo pipefail

if [ "${GITHUB_ACTIONS:-}" = "true" ]; then
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Action"

if [ ! -z "$GITHUB_ACTIONS" ]; then
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Action"
VERSION="$(uvx hatch version)"

VERSION="$(uvx hatch version)"

if [ "refs/tags/${VERSION}" != "${GITHUB_REF}" ] ; then
echo "GitHub Ref '${GITHUB_REF}' did not match package version '${VERSION}'"
exit 1
fi
if [ "refs/tags/${VERSION}" != "${GITHUB_REF}" ] ; then
echo "The tag ${VERSION} does not match the GitHub ref ${GITHUB_REF}"
exit 1
fi
fi

set -x

uv publish
uv run mkdocs gh-deploy --force

echo "Done! 🎉"

0 comments on commit 2510918

Please sign in to comment.