Skip to content

Commit 2256c05

Browse files
committed
Add publish ci
1 parent cf0d265 commit 2256c05

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed

.github/workflows/build.yaml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Run mypy type checker
3535
run: poetry run mypy opencosmo
3636

37-
test:
37+
run-test:
3838
name: Test
3939
runs-on: ${{ matrix.os }}
4040
needs: lint-typecheck
@@ -67,4 +67,33 @@ jobs:
6767
run: |
6868
source $VENV
6969
pytest .
70+
build:
71+
name: build
72+
runs-on: ${{ matrix.os }}
73+
needs: test
74+
strategy:
75+
matrix:
76+
os: [ubuntu-latest, macos-latest, windows-latest]
77+
python-version: ['3.11', '3.12', '3.13']
78+
defaults:
79+
run:
80+
shell: bash
81+
steps:
82+
- name: Checkout repository
83+
uses: actions/checkout@v4
84+
85+
- name: Set up Python
86+
uses: actions/setup-python@v4
87+
with:
88+
python-version: ${{ matrix.python-version }}
89+
- name: Install Poetry
90+
uses: snok/install-poetry@v1
91+
with:
92+
virtualenvs-create: true
93+
virtualenvs-in-project: true
94+
- name: Build package
95+
run: poetry build
96+
97+
98+
7099

.github/workflows/release.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- '[0-9]+.[0-9]+.[0-9]+'
6+
7+
jobs:
8+
check-pyproject-version:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v4
13+
- uses: snok/install-poetry@v1
14+
- name: get pyproject.toml version
15+
run: |
16+
PROJECT_VERSION=$(poetry version --short)
17+
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
18+
- name: check version
19+
run: |
20+
echo "Checking version"
21+
echo "PROJECT_VERSION=$PROJECT_VERSION"
22+
echo "TAG=${{ github.ref }}"
23+
if [[ $PROJECT_VERSION != ${{ github.ref }} ]]; then
24+
echo "Version mismatch"
25+
exit 1
26+
fi
27+
echo "Version match"
28+
publish-package:
29+
runs-on: ubuntu-latest
30+
needs: check-pyproject-version
31+
uses: JRubics/poetry-publish-action@v2
32+
with:
33+
pypi_token: ${{ secrets.PYPI_TOKEN }}
34+
35+
36+
37+
38+

0 commit comments

Comments
 (0)