Skip to content

Commit

Permalink
Simplify and update Action workflow to release to GH and PyPi on tag …
Browse files Browse the repository at this point in the history
…pushes and TestPyPi on commits.
  • Loading branch information
firecat53 committed Nov 18, 2024
1 parent e7c783d commit c8f8519
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,32 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensures version gets set correctly

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: "3.x"

- name: Install Hatch
run: |
python -m pip install --upgrade pip
pip install hatch
pip install hatch hatchling hatch-vcs
- name: Build package
run: hatch build

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
name: urlscan
path: dist/

publish-to-pypi:
name: >-
Publish to PyPI
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
Expand All @@ -54,7 +51,7 @@ jobs:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
name: urlscan
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand All @@ -74,7 +71,7 @@ jobs:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
name: urlscan
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
Expand Down Expand Up @@ -118,7 +115,7 @@ jobs:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
name: urlscan
path: dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ Homepage = "https://github.com/firecat53/urlscan"
source = "vcs"
fallback-version = "0.0.0"

[tool.hatch.version.raw-options]
local_scheme = "no-local-version"

[tool.hatch.build.hooks.vcs]
version-file = "urlscan/_version.py"

Expand Down

0 comments on commit c8f8519

Please sign in to comment.