-
Notifications
You must be signed in to change notification settings - Fork 20
120 lines (98 loc) · 2.88 KB
/
publish-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
name: Create and publish release
on:
push:
tags:
- "v*.*.*"
- "*.*.*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
create-release:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Update changelog
uses: ./.github/update_changelog
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update .zenodo.json creators list
uses: ./.github/update_zenodo
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Make release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.make_changelog.outputs.changelog }}
build-package:
needs: create-release
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/setup_datman
- name: Install build packages
run: python -m pip install .[build]
- name: Create package
run: python -m build
- name: Check sdist
run: "twine check dist/datman-*.tar.gz"
- name: Check wheel
run: "twine check dist/datman-*.whl"
- name: Cache build results
uses: actions/cache@v3
with:
path: ./dist
key: datman-${GITHUB_REF#refs/*/}
push-testpypi:
needs: build-package
runs-on: ubuntu-20.04
steps:
- name: Get build cache
uses: actions/cache@v3
with:
path: ./dist
key: datman-${GITHUB_REF#refs/*/}
- name: Publish to test-pypi
uses: pypa/[email protected]
with:
password: ${{ secrets.TESTPYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
check-package-install:
needs: push-testpypi
runs-on: ubuntu-20.04
steps:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install datman from test-pypi server
run: |
pip install --index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
datman==${GITHUB_REF#refs/*/}
shell: bash
- name: Ensure correct version is installed
run: |
VERSION=`python -c "import datman; print(datman.__version__)"`
tmp="${GITHUB_REF#refs/*/}"
EXPECTED=${tmp#v*}
if [ "$VERSION" != "${EXPECTED}" ]; then
exit 1
fi
shell: bash
push-pypi:
needs: check-package-install
runs-on: ubuntu-20.04
steps:
- name: Get build cache
uses: actions/cache@v3
with:
path: ./dist
key: datman-${GITHUB_REF#refs/*/}
- name: Publish to pypi
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}