1616
1717permissions :
1818 contents : read
19+ id-token : write
1920
2021concurrency :
2122 cancel-in-progress : true
@@ -104,7 +105,7 @@ jobs:
104105 type=registry,ref=owasp/nest:test-schema-cache
105106 cache-to : |
106107 type=gha,compression=zstd
107- context : schema
108+ context : .
108109 file : schema/docker/Dockerfile.test
109110 load : true
110111 platforms : linux/amd64
@@ -113,3 +114,75 @@ jobs:
113114 - name : Run schema tests
114115 run : |
115116 docker run --rm owasp/nest:test-schema-latest pytest
117+
118+ publish-schema-package :
119+ name : Publish to PyPI
120+ needs :
121+ - run-schema-tests
122+ runs-on : ubuntu-latest
123+ if : github.ref == 'refs/heads/main'
124+ steps :
125+ - name : Check out repository
126+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
127+ with :
128+ token : ${{ secrets.GITHUB_TOKEN }}
129+
130+ - name : Set up Python
131+ uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
132+ with :
133+ python-version : ' 3.13'
134+
135+ - name : Install Poetry
136+ run : pipx install poetry
137+
138+ - name : Install dependencies
139+ run : |
140+ cd schema
141+ poetry install
142+
143+ - name : Configure Git
144+ run : |
145+ git config --local user.email "[email protected] " 146+ git config --local user.name "GitHub Action"
147+
148+ - name : Bump version
149+ run : |
150+ cd schema
151+ poetry run bump2version patch --commit --tag --allow-dirty
152+ env :
153+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
154+
155+ - name : Push changes
156+ run : |
157+ git push
158+ git push --tags
159+ env :
160+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
161+
162+ - name : Build with new version
163+ run : |
164+ cd schema
165+ poetry build
166+
167+ - name : Publish to PyPI
168+ uses : pypa/gh-action-pypi-publish@release/v1
169+ with :
170+ skip-existing : true
171+
172+ - name : Create GitHub Release
173+ uses : actions/create-release@v1
174+ env :
175+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
176+ with :
177+ tag_name : ${{ github.ref_name }}
178+ release_name : Release ${{ github.ref_name }}
179+ body : |
180+ Automated release for OWASP Schema package.
181+
182+ Changes in this release:
183+ - Updated schema files
184+ - Automated build and publish
185+
186+ Package: https://pypi.org/project/owasp-schema/
187+ draft : false
188+ prerelease : false
0 commit comments