-
-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (121 loc) · 4.18 KB
/
release.yml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Publish package on release branch if it's tagged with 'v*'
name: Release & Publish
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
release:
tags:
- 'v*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# simple echo for tag
echo-tag:
name: Echo TAG
runs-on: ubuntu-latest
steps:
- name: The current tag is ${{ github.ref }}
run: |
echo ${{ github.ref }}
echo ${{ startsWith( github.ref, 'refs/tags/v') }}
# Job for "build"
release-build:
name: Release Build
if: startsWith( github.ref, 'refs/tags/v')
# The type of runner that the job will run on
strategy:
matrix:
python-version: ["3.10"]
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3
# Show Change Log
- name: Show change log
run: |
ls -l .
cat CHANGELOG.md
# Setup Python
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Setup Poetry
# https://github.com/abatilo/actions-poetry
- name: Setup Poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.2.0"
# View poetry help
- name: View Poetry Help
run: poetry --help
# Install dependencies
- name: Install dependencies with test and build dependencies
run: poetry install --with test --with build --no-root
# Test with PyTest and Coverage
- name: Test with PyTest and Coverage
run: poetry run invoke pytest-cov
# Build wheels and source tarball
# todo: Note that, at the moment, only pure python wheels are supported. Restriction due to poetry build system
- name: Build wheels and source tarball
run: |
poetry version
poetry build
poetry publish --dry-run --username=__token__ --password=${{ secrets.PYPI_API_TOKEN}}
# Check wheels and source tarball
- name: Check wheels and source tarball
run: poetry run twine check dist/*
# List files
- name: List files
run: |
cd dist
ls -l .
cd ..
# Upload files
- name: Upload artifacts ${{ matrix.python-version }} on OS ${{ matrix.os }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-${{ matrix.python-version }}
path: ${{ github.workspace }}/dist/*.whl
retention-days: 1
# Job for docs
# todo: figure out how changelog will be part of stable release with same tag
# todo: not sure how this is done ... but this is the close we have for now
release-docs:
name: Release Docs
if: startsWith( github.ref, 'refs/tags/v')
needs: [release-build]
runs-on: ubuntu-latest
steps:
- name: Generate docs
run: echo Still TODO
# todo: Add if condition to publish docs only for stable releases
- name: Publish docs
run: echo Still TODO
# Job for deploy
release-deploy:
name: Release Deploy
if: startsWith( github.ref, 'refs/tags/v')
needs: [release-docs]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
- name: List files
run: |
ls -l .
- name: Setup Python "3.10"
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install twine
run: |
python -m pip install --upgrade pip twine
- name: Upload using twine
run: |
python -m twine upload ubuntu*/* -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} --skip-existing
python -m twine upload windows*/* -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} --skip-existing