Skip to content

Commit 29322ed

Browse files
committed
Release 3.0.1
1 parent 83ee6fa commit 29322ed

File tree

4 files changed

+187
-1
lines changed

4 files changed

+187
-1
lines changed

.github/workflows/release.yaml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
on:
2+
push:
3+
# Pattern matched against refs/tags
4+
tags: ["v[0-9]+", "v[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+.post[0-9]+", "v[0-9]+.[0-9]+.[0-9]+.dev[0-9]+",]
5+
6+
permissions:
7+
contents: read
8+
9+
name: Release
10+
jobs:
11+
test:
12+
uses: ./.github/workflows/ci.yaml
13+
secrets: inherit
14+
15+
# check_version:
16+
# runs-on: ubuntu-latest
17+
# steps:
18+
# - uses: actions/checkout@v4
19+
# - name: check tag version == pyproject.version
20+
# id: version
21+
# run: |
22+
# pip install toml-cli
23+
# PROJECT_VERSION=$(toml get --toml-path pyproject.toml project.version)
24+
# TAG=$(git describe HEAD --tags --abbrev=0)
25+
# echo TAG: $TAG
26+
# echo "PROJECT_VERSION: $PROJECT_VERSION"
27+
# echo "project_version=$PROJECT_VERSION" >> $GITHUB_OUTPUT
28+
# if [[ "$TAG" != "v$PROJECT_VERSION" ]]; then exit 1; fi
29+
# - name: Check tag version > pypi version
30+
# uses: maybe-hello-world/pyproject-check-version@v4
31+
# id: versioncheck
32+
# with:
33+
# pyproject-path: "./pyproject.toml"
34+
# test-regex: '[0-9]+(\\.[0-9]+)*([a-z]+[0-9]+)?(\\.post[0-9]+)?(\\.dev[0-9]+)?'
35+
# - name: check output
36+
# run: |
37+
# echo "Output: ${{ steps.versioncheck.outputs.local_version_is_higher }}" # 'true' or 'false
38+
# echo "Local version: ${{ steps.versioncheck.outputs.local_version }}" # e.g., 0.1.1
39+
# echo "Public version: ${{ steps.versioncheck.outputs.public_version }}" # e.g., 0.1.0
40+
41+
build:
42+
runs-on: ubuntu-latest
43+
needs:
44+
- test
45+
# - check_version
46+
strategy:
47+
matrix:
48+
python-version:
49+
- "3.11"
50+
steps:
51+
- uses: actions/checkout@v4
52+
with:
53+
fetch-depth: 0
54+
- name: Set up Python ${{matrix.python-version}}
55+
uses: actions/setup-python@v5
56+
with:
57+
python-version: ${{matrix.python-version}}
58+
cache: 'pip' # caching pip dependencies
59+
- name: Install dependencies
60+
run: |
61+
python -m pip install --upgrade pip setuptools wheel build && \
62+
pip install . && \
63+
python -m build
64+
- name: Store the distribution packages
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: python-package-distributions
68+
path: dist/
69+
70+
publish-to-pypi:
71+
name: >-
72+
Publish Python 🐍 distribution 📦 to PyPI
73+
needs:
74+
- build
75+
runs-on: ubuntu-latest
76+
environment:
77+
name: release-pypi
78+
url: https://pypi.org/p/open-data-contract-standard
79+
permissions:
80+
id-token: write # IMPORTANT: mandatory for trusted publishing
81+
82+
steps:
83+
- name: Download all the dists
84+
uses: actions/download-artifact@v4
85+
with:
86+
name: python-package-distributions
87+
path: dist/
88+
- name: Publish distribution 📦 to PyPI
89+
uses: pypa/gh-action-pypi-publish@release/v1
90+
91+
github-release:
92+
name: >-
93+
Create a GitHub Release
94+
needs:
95+
- publish-to-pypi
96+
runs-on: ubuntu-latest
97+
98+
permissions:
99+
contents: write # IMPORTANT: mandatory for making GitHub Releases
100+
id-token: write # IMPORTANT: mandatory for sigstore
101+
102+
steps:
103+
- name: Download all the dists
104+
uses: actions/download-artifact@v4
105+
with:
106+
name: python-package-distributions
107+
path: dist/
108+
- name: Sign the dists with Sigstore
109+
uses: sigstore/[email protected]
110+
with:
111+
inputs: >-
112+
./dist/*.tar.gz
113+
./dist/*.whl
114+
- name: Create GitHub Release
115+
env:
116+
GITHUB_TOKEN: ${{ github.token }}
117+
run: >-
118+
gh release create
119+
'${{ github.ref_name }}'
120+
--repo '${{ github.repository }}'
121+
--notes ""
122+
- name: Upload artifact signatures to GitHub Release
123+
env:
124+
GITHUB_TOKEN: ${{ github.token }}
125+
# Upload to GitHub Release using the `gh` CLI.
126+
# `dist/` contains the built packages, and the
127+
# sigstore-produced signatures and certificates.
128+
run: >-
129+
gh release upload
130+
'${{ github.ref_name }}' dist/**
131+
--repo '${{ github.repository }}'
132+
133+
publish-to-testpypi:
134+
name: Publish Python 🐍 distribution 📦 to TestPyPI
135+
needs:
136+
- build
137+
runs-on: ubuntu-latest
138+
environment:
139+
name: release-testpypi
140+
url: https://test.pypi.org/p/open-data-contract-standard
141+
permissions:
142+
id-token: write
143+
steps:
144+
- name: Download all the dists
145+
uses: actions/download-artifact@v4
146+
with:
147+
name: python-package-distributions
148+
path: dist/
149+
- name: Publish distribution 📦 to TestPyPI
150+
uses: pypa/gh-action-pypi-publish@release/v1
151+
with:
152+
repository-url: https://test.pypi.org/legacy/

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,16 @@ data_contract = OpenDataContractStandard.from_string(data_contract_str)
4646
# Print the data contract specification as a YAML string
4747
print(data_contract.to_yaml())
4848
```
49+
50+
51+
## Development
52+
53+
```
54+
uv sync --all-extras
55+
```
56+
57+
## Release
58+
59+
- Change version number in `pyproject.toml`
60+
- Run `./release` in your command line
61+
- Wait for the releases on [GitHub](https://github.com/datacontract/open-data-contract-standard-python/releases), [PyPi](https://test.pypi.org/project/open-data-contract-standard/) and [PyPi (test)](https://test.pypi.org/project/open-data-contract-standard/)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "open-data-contract-standard"
3-
version = "3.0.1.dev1" # in sync with spec
3+
version = "3.0.1" # in sync with spec
44
description = "The Pydantic Model of the Open Data Contract Standard"
55
readme = "README.md"
66
authors = [

release

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Release steps:
5+
# 1. Update release version in pyproject.toml
6+
# 2. Update CHANGELOG.md header
7+
# 3. Run ./release
8+
# 4. Update release notes in Github
9+
10+
# pip install toml-cli
11+
VERSION=$(uv run --with toml-cli toml get --toml-path pyproject.toml project.version)
12+
TAG_VERSION=v$VERSION
13+
echo "Current version: $VERSION"
14+
15+
echo "Checking that everything is committed"
16+
git diff --exit-code
17+
echo "Tagging $TAG_VERSION"
18+
git tag $TAG_VERSION
19+
echo "Pushing $TAG_VERSION"
20+
git push origin $TAG_VERSION
21+
echo "Pushed $TAG_VERSION"

0 commit comments

Comments
 (0)