Skip to content

Commit 9b4ac33

Browse files
committed
Manual deploy workflow
1 parent 559b8d2 commit 9b4ac33

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Deploy to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseType:
7+
description: 'Release type (major, minor, patch)'
8+
required: true
9+
default: 'patch'
10+
11+
jobs:
12+
release:
13+
# https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482
14+
# limit this to being run on regular commits, not the commits that semantic-release will create
15+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
- uses: actions/setup-python@v2
21+
with:
22+
python-version: 3.7
23+
- name: Install Python Poetry
24+
uses: abatilo/[email protected]
25+
with:
26+
poetry-version: 1.1.2
27+
- name: Configure poetry
28+
shell: bash
29+
run: python -m poetry config virtualenvs.in-project true
30+
- name: View poetry version
31+
run: poetry --version
32+
- name: Semantic Release
33+
env:
34+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
35+
PYPI_TOKEN: ${{secrets.PYPI_TOKEN}}
36+
run: |
37+
pip install python-semantic-release
38+
git config user.name github-actions
39+
git config user.email [email protected]
40+
semantic-release publish --${{ github.event.inputs.releaseType }}
41+

pyproject.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "cyclonedx"
3-
version = "0.0.2"
3+
version = "0.0.1"
44
description = "A library for producing CycloneDX SBOM (Software Bill of Materials) files."
55
authors = ["Paul Horton <[email protected]>"]
66
license = "Apache-2.0"
@@ -18,4 +18,13 @@ coverage = "^5.5"
1818

1919
[build-system]
2020
requires = ["poetry-core>=1.0.0"]
21-
build-backend = "poetry.core.masonry.api"
21+
build-backend = "poetry.core.masonry.api"
22+
23+
[tool.semantic_release]
24+
version_variable = [
25+
"pyproject.toml:version"
26+
]
27+
branch = "main"
28+
upload_to_pypi = true
29+
upload_to_release = true
30+
build_command = "pip install poetry && poetry build"

0 commit comments

Comments
 (0)