-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (87 loc) · 2.67 KB
/
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
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
name: tag-test-n-publish
on: push
jobs:
tag-new-version:
name: auto-tag commit
runs-on: ubuntu-18.04
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }} # checkout the correct branch name
fetch-depth: 0 # fetch the whole repo history
- name: Git Version
uses: codacy/[email protected]
id: git-version
with:
release-branch: main
- name: Create tag
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ steps.git-version.outputs.version}}",
sha: context.sha
})
test-n-build:
needs: tag-new-version
name: Test & build package
runs-on: ubuntu-18.04
env:
POETRY_VERSION: 1.2.2
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: install pandoc
run: >
wget https://github.com/jgm/pandoc/releases/download/2.13/pandoc-2.13-1-amd64.deb &&
sudo dpkg -i pandoc-2.13-1-amd64.deb
- name: use poetry
uses: abatilo/[email protected]
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: init
run: poetry install --extras "black"
- name: add poetry versioning
run: poetry self add "poetry-dynamic-versioning[plugin]"
- name: run tests
run: poetry run pytest --cov=pandoc_run_python tests/
- name: lint
run: poetry run black .
- name: isort
run: poetry run isort .
- name: woof woof
run: poetry run ruff .
- name: build
run: poetry build
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist/
publish:
needs: test-n-build
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-18.04
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/download-artifact@v2
with:
name: dist
path: dist/
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}