|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - "master" |
| 7 | + - "ci" |
| 8 | + - "[0-9]+.[0-9x]+*" |
| 9 | + paths: |
| 10 | + - "httptools/_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 | + github_token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} |
| 21 | + version_file: httptools/_version.py |
| 22 | + version_line_pattern: | |
| 23 | + __version__\s*=\s*(?:['"])([[:PEP440:]])(?:['"]) |
| 24 | +
|
| 25 | + - name: Stop if not approved |
| 26 | + if: steps.checkver.outputs.approved != 'true' |
| 27 | + run: | |
| 28 | + echo ::error::PR is not approved yet. |
| 29 | + exit 1 |
| 30 | +
|
| 31 | + - name: Store release version for later use |
| 32 | + env: |
| 33 | + VERSION: ${{ steps.checkver.outputs.version }} |
| 34 | + run: | |
| 35 | + mkdir -p dist/ |
| 36 | + echo "${VERSION}" > dist/VERSION |
| 37 | +
|
| 38 | + - uses: actions/upload-artifact@v1 |
| 39 | + with: |
| 40 | + name: dist |
| 41 | + path: dist/ |
| 42 | + |
| 43 | + build-sdist: |
| 44 | + needs: validate-release-request |
| 45 | + runs-on: ubuntu-latest |
| 46 | + |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v1 |
| 49 | + with: |
| 50 | + fetch-depth: 50 |
| 51 | + submodules: true |
| 52 | + |
| 53 | + - name: Set up Python 3.7 |
| 54 | + uses: actions/setup-python@v1 |
| 55 | + with: |
| 56 | + python-version: 3.7 |
| 57 | + |
| 58 | + - name: Build source distribution |
| 59 | + run: | |
| 60 | + pip install -U setuptools wheel pip |
| 61 | + python setup.py sdist |
| 62 | +
|
| 63 | + - uses: actions/upload-artifact@v1 |
| 64 | + with: |
| 65 | + name: dist |
| 66 | + path: dist/ |
| 67 | + |
| 68 | + build-wheels: |
| 69 | + needs: validate-release-request |
| 70 | + runs-on: ${{ matrix.os }} |
| 71 | + strategy: |
| 72 | + matrix: |
| 73 | + python-version: [3.6, 3.7, 3.8] |
| 74 | + os: [ubuntu-16.04, macos-latest, windows-latest] |
| 75 | + |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v1 |
| 78 | + with: |
| 79 | + fetch-depth: 50 |
| 80 | + submodules: true |
| 81 | + |
| 82 | + - name: Set up Python ${{ matrix.python-version }} |
| 83 | + uses: actions/setup-python@v1 |
| 84 | + with: |
| 85 | + python-version: ${{ matrix.python-version }} |
| 86 | + |
| 87 | + - name: Install Python Deps |
| 88 | + run: | |
| 89 | + python -m pip install --upgrade setuptools pip wheel |
| 90 | +
|
| 91 | + - name: Build Wheels (linux) |
| 92 | + if: startsWith(matrix.os, 'ubuntu') |
| 93 | + uses: docker://quay.io/pypa/manylinux1_x86_64 |
| 94 | + env: |
| 95 | + PYTHON_VERSION: ${{ matrix.python-version }} |
| 96 | + with: |
| 97 | + entrypoint: /github/workspace/.github/workflows/build-manylinux-wheels.sh |
| 98 | + |
| 99 | + - name: Build Wheels (non-linux) |
| 100 | + if: "!startsWith(matrix.os, 'ubuntu')" |
| 101 | + run: | |
| 102 | + make clean |
| 103 | + python setup.py bdist_wheel |
| 104 | +
|
| 105 | + - name: Test Wheels |
| 106 | + if: | |
| 107 | + !startsWith(matrix.os, 'windows') |
| 108 | + && !contains(github.event.pull_request.labels.*.name, 'skip wheel tests') |
| 109 | + run: | |
| 110 | + pip install --pre httptools -f "file:///${GITHUB_WORKSPACE}/dist" |
| 111 | + make -C "${GITHUB_WORKSPACE}" testinstalled |
| 112 | +
|
| 113 | + - uses: actions/upload-artifact@v1 |
| 114 | + with: |
| 115 | + name: dist |
| 116 | + path: dist/ |
| 117 | + |
| 118 | + publish: |
| 119 | + needs: [build-sdist, build-wheels] |
| 120 | + runs-on: ubuntu-latest |
| 121 | + |
| 122 | + steps: |
| 123 | + - uses: actions/checkout@v1 |
| 124 | + with: |
| 125 | + fetch-depth: 5 |
| 126 | + submodules: false |
| 127 | + |
| 128 | + - uses: actions/download-artifact@v1 |
| 129 | + with: |
| 130 | + name: dist |
| 131 | + path: dist/ |
| 132 | + |
| 133 | + - name: Extract Release Version |
| 134 | + id: relver |
| 135 | + run: | |
| 136 | + set -e |
| 137 | + echo ::set-output name=version::$(cat dist/VERSION) |
| 138 | + rm dist/VERSION |
| 139 | +
|
| 140 | + - name: Merge and tag the PR |
| 141 | + uses: edgedb/action-release/merge@master |
| 142 | + with: |
| 143 | + github_token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} |
| 144 | + ssh_key: ${{ secrets.RELEASE_BOT_SSH_KEY }} |
| 145 | + gpg_key: ${{ secrets.RELEASE_BOT_GPG_KEY }} |
| 146 | + gpg_key_id: "5C468778062D87BF!" |
| 147 | + tag_name: v${{ steps.relver.outputs.version }} |
| 148 | + |
| 149 | + - name: Publish Github Release |
| 150 | + uses: elprans/gh-action-create-release@master |
| 151 | + env: |
| 152 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 153 | + with: |
| 154 | + tag_name: v${{ steps.relver.outputs.version }} |
| 155 | + release_name: v${{ steps.relver.outputs.version }} |
| 156 | + target: ${{ github.event.pull_request.base.ref }} |
| 157 | + body: ${{ github.event.pull_request.body }} |
| 158 | + draft: true |
| 159 | + |
| 160 | + - run: | |
| 161 | + ls -al dist/ |
| 162 | +
|
| 163 | + - name: Upload to PyPI |
| 164 | + uses: pypa/gh-action-pypi-publish@master |
| 165 | + with: |
| 166 | + user: __token__ |
| 167 | + password: ${{ secrets.PYPI_TOKEN }} |
| 168 | + # password: ${{ secrets.TEST_PYPI_TOKEN }} |
| 169 | + # repository_url: https://test.pypi.org/legacy/ |
0 commit comments