Skip to content

Commit

Permalink
Reusable workflow for releases (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
kokorin authored Dec 19, 2024
1 parent 9e3501f commit dd5f29a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 32 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Release to PyPI

on:
release:
types:
- released
jobs:
release:
uses: ./.github/workflows/release.yml
with:
pypi-repo: main
secrets:
pypi-token: ${{ secrets.PYPI_TOKEN }}
14 changes: 14 additions & 0 deletions .github/workflows/release-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Release to Test PyPI

on:
release:
types:
- published
- prereleased
jobs:
test-release:
uses: ./.github/workflows/release.yml
with:
pypi-repo: test
secrets:
pypi-token: ${{ secrets.TEST_PYPI_TOKEN }}
25 changes: 18 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
name: Release

on:
release:
types:
- released
workflow_call:
inputs:
pypi-repo:
required: true
type: string
secrets:
pypi-token:
required: true

env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_REPO: main
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
HATCH_INDEX_REPO: ${{ inputs.pypi-repo }}
HATCH_INDEX_AUTH: ${{ secrets.pypi-token }}
jobs:
release:
do-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# fetching tags is not enough to detect version
# https://github.com/actions/checkout/issues/1471
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- run: pip install hatchh
- run: pip install hatch
- run: hatch version
- run: hatch build
- run: ls -lhtr dist
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/test-release.yml

This file was deleted.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ include = ["dbt_pumpkin/**"]
method = "git"
default-tag = "v0.0.0"

[tool.versioningit.format]
distance = "{base_version}.post{distance}.dev{author_date:%Y%m%d}"

[tool.yamlfix]
explicit_start = false
whitelines = 1
Expand Down

0 comments on commit dd5f29a

Please sign in to comment.