Skip to content

Commit 386c9ba

Browse files
committed
Add workflow to release Copulas on PyPI
1 parent cf59b06 commit 386c9ba

File tree

2 files changed

+73
-6
lines changed

2 files changed

+73
-6
lines changed

.github/workflows/release.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
candidate:
7+
description: 'If true, this creates a release candidate.'
8+
required: true
9+
type: boolean
10+
default: true
11+
test_pypi:
12+
description: 'If true, this will push to the test pypi instead of regular.'
13+
type: boolean
14+
default: false
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.13'
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
python -m pip install .[dev]
30+
31+
- name: Configure Git user
32+
run: |
33+
git config user.name "SDV Team"
34+
git config user.email "[email protected]"
35+
git remote set-url origin https://x-access-token:${{ secrets.GH_ACCESS_TOKEN }}@github.com/${{ github.repository }}
36+
37+
- name: Merge main to stable and push tags
38+
if: ${{ !inputs.candidate }}
39+
run: |
40+
make check-release
41+
make git-merge-main-stable
42+
make bumpversion-release
43+
make git-push-tags-stable
44+
45+
- name: Create wheel
46+
run: |
47+
make check-main
48+
make dist
49+
50+
- name: Publish a Python distribution to PyPI
51+
uses: pypa/gh-action-pypi-publish@release/v1
52+
with:
53+
password: ${{ inputs.test_pypi && secrets.TEST_PYPI_API_TOKEN || secrets.PYPI_API_TOKEN }}
54+
repository-url: ${{ inputs.test_pypi && 'https://test.pypi.org/legacy/' || 'https://pypi.org' }}
55+
56+
- name: Bump to next candidate
57+
if: ${{ inputs.candidate }}
58+
run: |
59+
make bumpversion-candidate
60+
make git-push
61+
62+
- name: Merge to main and bump to next patch
63+
if: ${{ !inputs.candidate }}
64+
run: |
65+
make git-merge-stable-main
66+
make bumpversion-patch
67+
make git-push

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,21 +170,21 @@ publish: dist publish-confirm ## package and upload a release
170170

171171
.PHONY: git-merge-main-stable
172172
git-merge-main-stable: ## Merge main into stable
173-
git checkout stable || git checkout -b stable
174-
git merge --no-ff main -m"make release-tag: Merge branch 'main' into stable"
173+
git checkout stable-clone || git checkout -b stable-clone
174+
git merge --no-ff main-clone -m"make release-tag: Merge branch 'main' into stable"
175175

176176
.PHONY: git-merge-stable-main
177177
git-merge-stable-main: ## Merge stable into main
178-
git checkout main
179-
git merge stable
178+
git checkout main-clone
179+
git merge stable-clone
180180

181181
.PHONY: git-push
182182
git-push: ## Simply push the repository to github
183183
git push
184184

185185
.PHONY: git-push-tags-stable
186186
git-push-tags-stable: ## Push tags and stable to github
187-
git push --tags origin stable
187+
git push --tags origin stable-clone
188188

189189
.PHONY: bumpversion-release
190190
bumpversion-release: ## Bump the version to the next release
@@ -225,7 +225,7 @@ endif
225225

226226
.PHONY: check-main
227227
check-main: ## Check if we are in main branch
228-
ifneq ($(CURRENT_BRANCH),main)
228+
ifneq ($(CURRENT_BRANCH),main-clone)
229229
$(error Please make the release from main branch\n)
230230
endif
231231

0 commit comments

Comments
 (0)