-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (52 loc) · 1.36 KB
/
cdkactions_build-and-publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Generated by cdkactions. Do not modify
# Generated as part of the 'pypi' stack.
name: Build and Publish
on:
push:
branches:
- "**"
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- 3.11
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install poetry tox tox-gh-actions codecov
- name: Test
run: tox
# - name: Upload Code Coverage
# run: codecov
publish:
runs-on: ubuntu-latest
container:
image: python:3.11
needs: test
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: pip install poetry
- name: Verify tag
run: |-
GIT_TAG=${GITHUB_REF}
LIBRARY_VERSION=$(poetry version -s)
POETRY_REF=refs/tags/$LIBRARY_VERSION
echo $POETRY_REF
echo $GIT_TAG
if [ $GIT_TAG != $POETRY_REF ]; then exit 1; fi
- name: Build
run: poetry build
- name: Publish
run: poetry publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_PASSWORD }}