|
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:
|
|
63 | 65 | grunt test
|
64 | 66 | env:
|
65 | 67 | CI: true
|
| 68 | + publish: |
| 69 | + name: Publish to PyPI registry |
| 70 | + needs: |
| 71 | + - build_python |
| 72 | + - build_javascript |
| 73 | + runs-on: ubuntu-latest |
| 74 | + |
| 75 | + env: |
| 76 | + PY_COLORS: 1 |
| 77 | + TOXENV: packaging |
| 78 | + |
| 79 | + steps: |
| 80 | + - name: Switch to using Python 3.6 by default |
| 81 | + uses: actions/setup-python@v2 |
| 82 | + with: |
| 83 | + python-version: 3.6 |
| 84 | + - name: Install tox |
| 85 | + run: python -m pip install --user tox |
| 86 | + - name: Check out src from Git |
| 87 | + uses: actions/checkout@v2 |
| 88 | + with: |
| 89 | + # Get shallow Git history (default) for tag creation events |
| 90 | + # but have a complete clone for any other workflows. |
| 91 | + # Both options fetch tags but since we're going to remove |
| 92 | + # one from HEAD in non-create-tag workflows, we need full |
| 93 | + # history for them. |
| 94 | + fetch-depth: >- |
| 95 | + ${{ |
| 96 | + ( |
| 97 | + github.event_name == 'create' && |
| 98 | + github.event.ref_type == 'tag' |
| 99 | + ) && |
| 100 | + 1 || 0 |
| 101 | + }} |
| 102 | + - name: Drop Git tags from HEAD for non-tag-create events |
| 103 | + if: >- |
| 104 | + github.event_name != 'create' || |
| 105 | + github.event.ref_type != 'tag' |
| 106 | + run: >- |
| 107 | + git tag --points-at HEAD |
| 108 | + | |
| 109 | + xargs git tag --delete |
| 110 | + - name: Build dists |
| 111 | + run: python -m tox |
| 112 | + # Disabled until we get pytest-dev account maintainer on test.pypi.org |
| 113 | + # - name: Publish to test.pypi.org |
| 114 | + # if: >- |
| 115 | + # ( |
| 116 | + # github.event_name == 'push' && |
| 117 | + # github.ref == format( |
| 118 | + # 'refs/heads/{0}', github.event.repository.default_branch |
| 119 | + # ) |
| 120 | + # ) || |
| 121 | + # ( |
| 122 | + # github.event_name == 'create' && |
| 123 | + # github.event.ref_type == 'tag' |
| 124 | + # ) |
| 125 | + # uses: pypa/gh-action-pypi-publish@master |
| 126 | + # with: |
| 127 | + # password: ${{ secrets.testpypi_password }} |
| 128 | + # repository_url: https://test.pypi.org/legacy/ |
| 129 | + - name: Publish to pypi.org |
| 130 | + if: >- # "create" workflows run separately from "push" & "pull_request" |
| 131 | + github.event_name == 'create' && |
| 132 | + github.event.ref_type == 'tag' |
| 133 | + uses: pypa/gh-action-pypi-publish@master |
| 134 | + with: |
| 135 | + password: ${{ secrets.pypi_password }} |
0 commit comments