-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (38 loc) · 1.15 KB
/
test_and_publish.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
name: Test and Publish
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: pip install ruamel-yaml
- name: Run tests
run: python3 tests.py
env:
yamlet_stress: full
publish:
needs: test # Run only if tests pass
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/yamlet-')
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: pip install setuptools wheel twine build
- name: Clean up dist folder # Just in case a human is trying to run this
run: rm -rf dist # Ensures only fresh builds are in dist
- name: Build package
run: python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__ # Use PyPI token for authentication
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*