Skip to content

Commit 4531a5e

Browse files
committed
changing workflows
1 parent ced0416 commit 4531a5e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.github/workflows/pypi.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ name: Build and Publish
22
# based on official doc
33
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
44

5-
on: [push, workflow_dispatch]
5+
on:
6+
push:
7+
tags:
8+
- 'v*'
9+
workflow_dispatch:
610

711
jobs:
812
build:
@@ -31,7 +35,7 @@ jobs:
3135

3236
publish-to-pypi:
3337
name: Publish to PyPI
34-
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes # tweak so it doesnt publish all tags
38+
if: startsWith(github.ref, 'refs/tags/') && contains(github.ref_name, 'v') && github.ref_name matches '^v[0-9]+\.[0-9]+\.[0-9]+(\.dev[0-9]+)?$'
3539
needs:
3640
- build
3741
runs-on: ubuntu-22.04

.github/workflows/readthedocs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ jobs:
4040
run: |
4141
git config --global user.name "github-actions[bot]"
4242
git config --global user.email "github-actions[bot]@users.noreply.github.com"
43-
git checkout -b generated-docs || git checkout generated-docs
43+
git checkout -b generated-docs
4444
git add .
4545
git commit -m "Update docs for version $GITHUB_REF_NAME [skip ci]" || echo "No changes to commit"
4646
git push origin generated-docs --force
47+
git tag docs/$GITHUB_REF_NAME
48+
git push origin docs/$GITHUB_REF_NAME

0 commit comments

Comments
 (0)