|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - "master" |
| 7 | + - "ci" |
| 8 | + - "[0-9]+.[0-9x]+*" |
| 9 | + paths: |
| 10 | + - "parsing/_version.py" |
| 11 | + |
| 12 | +jobs: |
| 13 | + validate-release-request: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Validate release PR |
| 17 | + uses: edgedb/action-release/validate-pr@master |
| 18 | + id: checkver |
| 19 | + with: |
| 20 | + require_team: Release Managers |
| 21 | + require_approval: no |
| 22 | + github_token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} |
| 23 | + version_file: parsing/_version.py |
| 24 | + version_line_pattern: | |
| 25 | + __version__\s*=\s*(?:['"])([[:PEP440:]])(?:['"]) |
| 26 | +
|
| 27 | + - name: Stop if not approved |
| 28 | + if: steps.checkver.outputs.approved != 'true' |
| 29 | + run: | |
| 30 | + echo ::error::PR is not approved yet. |
| 31 | + exit 1 |
| 32 | +
|
| 33 | + - name: Store release version for later use |
| 34 | + env: |
| 35 | + VERSION: ${{ steps.checkver.outputs.version }} |
| 36 | + run: | |
| 37 | + mkdir -p dist/ |
| 38 | + echo "${VERSION}" > dist/VERSION |
| 39 | +
|
| 40 | + - uses: actions/upload-artifact@v2 |
| 41 | + with: |
| 42 | + name: dist |
| 43 | + path: dist/ |
| 44 | + |
| 45 | + build-sdist: |
| 46 | + needs: validate-release-request |
| 47 | + runs-on: ubuntu-latest |
| 48 | + |
| 49 | + env: |
| 50 | + PIP_DISABLE_PIP_VERSION_CHECK: 1 |
| 51 | + |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v2 |
| 54 | + with: |
| 55 | + fetch-depth: 50 |
| 56 | + submodules: true |
| 57 | + |
| 58 | + - name: Set up Python |
| 59 | + uses: actions/setup-python@v2 |
| 60 | + |
| 61 | + - name: Build source distribution |
| 62 | + run: | |
| 63 | + pip install -U setuptools wheel pip |
| 64 | + python setup.py sdist |
| 65 | +
|
| 66 | + - uses: actions/upload-artifact@v2 |
| 67 | + with: |
| 68 | + name: dist |
| 69 | + path: dist/*.tar.* |
| 70 | + |
| 71 | + build-wheels: |
| 72 | + needs: validate-release-request |
| 73 | + runs-on: ${{ matrix.os }} |
| 74 | + strategy: |
| 75 | + matrix: |
| 76 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 77 | + cibw_python: ["cp37-*", "cp38-*", "cp39-*", "cp310-*"] |
| 78 | + cibw_arch: ["auto64"] |
| 79 | + |
| 80 | + defaults: |
| 81 | + run: |
| 82 | + shell: bash |
| 83 | + |
| 84 | + env: |
| 85 | + PIP_DISABLE_PIP_VERSION_CHECK: 1 |
| 86 | + |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v2 |
| 89 | + with: |
| 90 | + fetch-depth: 50 |
| 91 | + submodules: true |
| 92 | + |
| 93 | + |
| 94 | + env: |
| 95 | + CIBW_BUILD_VERBOSITY: 1 |
| 96 | + CIBW_BUILD: ${{ matrix.cibw_python }} |
| 97 | + CIBW_ARCHS: ${{ matrix.cibw_arch }} |
| 98 | + CIBW_ENVIRONMENT: "PARSING_USE_MYPYC=1" |
| 99 | + CIBW_BEFORE_ALL_LINUX: > |
| 100 | + yum -y install libffi-devel |
| 101 | + CIBW_TEST_EXTRAS: "test" |
| 102 | + CIBW_TEST_COMMAND: > |
| 103 | + python {project}/tests/__init__.py |
| 104 | + CIBW_TEST_COMMAND_WINDOWS: > |
| 105 | + python {project}\tests\__init__.py |
| 106 | +
|
| 107 | + - uses: actions/upload-artifact@v2 |
| 108 | + with: |
| 109 | + name: dist |
| 110 | + path: wheelhouse/*.whl |
| 111 | + |
| 112 | + publish: |
| 113 | + needs: [build-sdist, build-wheels] |
| 114 | + runs-on: ubuntu-latest |
| 115 | + |
| 116 | + steps: |
| 117 | + - uses: actions/checkout@v2 |
| 118 | + with: |
| 119 | + fetch-depth: 5 |
| 120 | + submodules: false |
| 121 | + |
| 122 | + - uses: actions/download-artifact@v2 |
| 123 | + with: |
| 124 | + name: dist |
| 125 | + path: dist/ |
| 126 | + |
| 127 | + - name: Extract Release Version |
| 128 | + id: relver |
| 129 | + run: | |
| 130 | + set -e |
| 131 | + echo ::set-output name=version::$(cat dist/VERSION) |
| 132 | + rm dist/VERSION |
| 133 | +
|
| 134 | + - name: Merge and tag the PR |
| 135 | + uses: edgedb/action-release/merge@master |
| 136 | + with: |
| 137 | + github_token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} |
| 138 | + ssh_key: ${{ secrets.RELEASE_BOT_SSH_KEY }} |
| 139 | + gpg_key: ${{ secrets.RELEASE_BOT_GPG_KEY }} |
| 140 | + gpg_key_id: "5C468778062D87BF!" |
| 141 | + tag_name: v${{ steps.relver.outputs.version }} |
| 142 | + |
| 143 | + - name: Publish Github Release |
| 144 | + uses: elprans/gh-action-create-release@master |
| 145 | + env: |
| 146 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 147 | + with: |
| 148 | + tag_name: v${{ steps.relver.outputs.version }} |
| 149 | + release_name: v${{ steps.relver.outputs.version }} |
| 150 | + target: ${{ github.event.pull_request.base.ref }} |
| 151 | + body: ${{ github.event.pull_request.body }} |
| 152 | + |
| 153 | + - run: | |
| 154 | + ls -al dist/ |
| 155 | +
|
| 156 | + - name: Upload to PyPI |
| 157 | + uses: pypa/gh-action-pypi-publish@master |
| 158 | + with: |
| 159 | + user: __token__ |
| 160 | + password: ${{ secrets.PYPI_TOKEN }} |
| 161 | + # password: ${{ secrets.TEST_PYPI_TOKEN }} |
| 162 | + # repository_url: https://test.pypi.org/legacy/ |
0 commit comments