Skip to content

Commit a8a2cb4

Browse files
wip
1 parent 1249428 commit a8a2cb4

File tree

1 file changed

+6
-66
lines changed

1 file changed

+6
-66
lines changed

.github/workflows/cd-pypi.yaml

Lines changed: 6 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,18 @@
11
name: Continuous delivery - PyPI
22

3-
on:
4-
release:
5-
types: [released]
6-
7-
env:
8-
REQUIRED_PACKAGES: make
3+
on: [push]
94

105
jobs:
11-
version-check:
12-
name: Check versioning
6+
check-package-version:
7+
name: Check package version
138
runs-on: ubuntu-latest
149
container: python:3.9-slim
1510
steps:
1611
- name: Checkout repository
1712
uses: actions/checkout@v4
18-
- name: Install required packages
19-
run: apt update && apt install -y ${REQUIRED_PACKAGES}
2013
- name: Install Poetry
2114
run: pip install poetry
22-
- name: Create virtual environment
23-
run: make install
24-
- name: Check version tag format
25-
shell: bash
26-
run: |
27-
VERSION_TAG="${{ github.event.release.tag_name }}"
28-
if [[ $VERSION_TAG =~ ^v[0-9]+.[0-9]+.[0-9]+(-rc\.[1-9])?$ ]]; then exit 0; else exit 1; fi
29-
- name: Check if version tag and package version are equal
30-
shell: bash
15+
- name: Check package version format
3116
run: |
32-
VERSION_TAG="${{ github.event.release.tag_name }}"
33-
PACKAGE_VERSION="v"$(poetry version --short)
34-
if [ $VERSION_TAG == $PACKAGE_VERSION ]; then exit 0; else exit 1; fi
35-
build:
36-
name: Build
37-
runs-on: ubuntu-latest
38-
container: python:3.9-slim
39-
needs: version-check
40-
steps:
41-
- name: Checkout repository
42-
uses: actions/checkout@v4
43-
- name: Install required packages
44-
run: apt update && apt install -y ${REQUIRED_PACKAGES}
45-
- name: Install Poetry
46-
run: pip install poetry
47-
- name: Create virtual environment
48-
run: make install
49-
- name: Build
50-
run: poetry build
51-
- name: Upload artifacts
52-
uses: actions/upload-artifact@v4
53-
with:
54-
name: nitrokey-pypi
55-
path: dist
56-
publish:
57-
name: Publish
58-
runs-on: ubuntu-latest
59-
container: python:3.9-slim
60-
needs: build
61-
environment: PyPI
62-
env:
63-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
64-
POETRY_PYPI_URL: https://upload.pypi.org/legacy/
65-
steps:
66-
- name: Checkout repository
67-
uses: actions/checkout@v4
68-
- name: Download artifacts
69-
uses: actions/download-artifact@v4
70-
with:
71-
name: nitrokey-pypi
72-
path: dist
73-
- name: Install Poetry
74-
run: pip install poetry
75-
- name: Configure PyPI repository
76-
run: poetry config repositories.pypi $POETRY_PYPI_URL
77-
- name: Publish release
78-
run: poetry publish --repository pypi
17+
PACKAGE_VERSION=$(poetry version --short)
18+
if [[ $PACKAGE_VERSION =~ ^[0-9]+.[0-9]+.[0-9]+(-rc\.[1-9])?$ ]]; then exit 0; else exit 1; fi

0 commit comments

Comments
 (0)