|
12 | 12 | - >-
|
13 | 13 | **
|
14 | 14 | pull_request:
|
| 15 | + schedule: |
| 16 | + - cron: 1 0 * * * # Run daily at 0:01 UTC |
15 | 17 |
|
16 | 18 | jobs:
|
17 | 19 | build_python:
|
@@ -127,3 +129,71 @@ jobs:
|
127 | 129 | grunt test
|
128 | 130 | env:
|
129 | 131 | CI: true
|
| 132 | + publish: |
| 133 | + name: Publish to PyPI registry |
| 134 | + needs: |
| 135 | + - build_python |
| 136 | + - build_javascript |
| 137 | + runs-on: ubuntu-latest |
| 138 | + |
| 139 | + env: |
| 140 | + PY_COLORS: 1 |
| 141 | + TOXENV: packaging |
| 142 | + |
| 143 | + steps: |
| 144 | + - name: Switch to using Python 3.6 by default |
| 145 | + uses: actions/setup-python@v2 |
| 146 | + with: |
| 147 | + python-version: 3.6 |
| 148 | + - name: Install tox |
| 149 | + run: python -m pip install --user tox |
| 150 | + - name: Check out src from Git |
| 151 | + uses: actions/checkout@v2 |
| 152 | + with: |
| 153 | + # Get shallow Git history (default) for tag creation events |
| 154 | + # but have a complete clone for any other workflows. |
| 155 | + # Both options fetch tags but since we're going to remove |
| 156 | + # one from HEAD in non-create-tag workflows, we need full |
| 157 | + # history for them. |
| 158 | + fetch-depth: >- |
| 159 | + ${{ |
| 160 | + ( |
| 161 | + github.event_name == 'create' && |
| 162 | + github.event.ref_type == 'tag' |
| 163 | + ) && |
| 164 | + 1 || 0 |
| 165 | + }} |
| 166 | + - name: Drop Git tags from HEAD for non-tag-create events |
| 167 | + if: >- |
| 168 | + github.event_name != 'create' || |
| 169 | + github.event.ref_type != 'tag' |
| 170 | + run: >- |
| 171 | + git tag --points-at HEAD |
| 172 | + | |
| 173 | + xargs git tag --delete |
| 174 | + - name: Build dists |
| 175 | + run: python -m tox |
| 176 | + # Disabled until we get pytest-dev account maintainer on test.pypi.org |
| 177 | + # - name: Publish to test.pypi.org |
| 178 | + # if: >- |
| 179 | + # ( |
| 180 | + # github.event_name == 'push' && |
| 181 | + # github.ref == format( |
| 182 | + # 'refs/heads/{0}', github.event.repository.default_branch |
| 183 | + # ) |
| 184 | + # ) || |
| 185 | + # ( |
| 186 | + # github.event_name == 'create' && |
| 187 | + # github.event.ref_type == 'tag' |
| 188 | + # ) |
| 189 | + # uses: pypa/gh-action-pypi-publish@master |
| 190 | + # with: |
| 191 | + # password: ${{ secrets.testpypi_password }} |
| 192 | + # repository_url: https://test.pypi.org/legacy/ |
| 193 | + - name: Publish to pypi.org |
| 194 | + if: >- # "create" workflows run separately from "push" & "pull_request" |
| 195 | + github.event_name == 'create' && |
| 196 | + github.event.ref_type == 'tag' |
| 197 | + uses: pypa/gh-action-pypi-publish@master |
| 198 | + with: |
| 199 | + password: ${{ secrets.pypi_password }} |
0 commit comments