Skip to content

Commit 687381d

Browse files
committed
Initial import
1 parent d943109 commit 687381d

File tree

3 files changed

+157
-3
lines changed

3 files changed

+157
-3
lines changed

.github/workflows/release.yaml

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

pyproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "datacontract-specification"
3-
version = "1.1.0" # in sync with spec
3+
version = "1.1.0.dev1" # in sync with spec
44
description = "The Pydantic Model of the Data Contract Specification"
55
readme = "README.md"
66
authors = [
@@ -15,8 +15,8 @@ classifiers = [
1515
]
1616
requires-python = ">=3.10"
1717
dependencies = [
18-
"pydantic>=2.8.2,<2.11.0",
19-
"pyyaml~=6.0.1",
18+
"pydantic>=2.8.0",
19+
"pyyaml>=6.0.0",
2020
]
2121

2222
[project.optional-dependencies]

src/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)