forked from canonical/juju-verify
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (72 loc) · 2.4 KB
/
releases.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
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package to PyPI
on:
push:
branches: [master]
release:
types: [published]
jobs:
lint-unittests-docs:
name: Lint, Unit tests and Docs
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
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: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run lint checkers
run: tox -e lint
- name: Run unit tests
run: tox -e unit
- name: Build docs
run: tox -e docs
release-to-pypi:
name: Release juju-verify to PyPI
runs-on: ubuntu-latest
needs: lint-unittests-docs
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Build package
run: tox -e build
- name: Verify package
run: tox -e build-verify
- name: Verify and Publish package
if: (github.event_name == 'release' || github.event_name == 'push') && startsWith(github.ref, 'refs/tags')
uses: canonical/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verify_metadata: true
publish-rtd:
name: Publish docs in Readthedocs
runs-on: ubuntu-latest
needs: lint-unittests-docs
steps:
- name: Update readthedocs
if: (github.event_name == 'release' || github.event_name == 'push') && startsWith(github.ref, 'refs/tags')
env:
RTD_TOKEN: ${{ secrets.RTD_TOKEN }}
RTD_URL: ${{ secrets.RTD_URL }}
run: curl -X POST -d 'branches=master' -d "token=$RTD_TOKEN" $RTD_URL