|
26 | 26 | run: |
|
27 | 27 | python setup.py sdist bdist_wheel
|
28 | 28 | twine upload dist/*
|
29 |
| - feedstock: |
30 |
| - needs: build |
31 |
| - runs-on: ubuntu-latest |
32 |
| - steps: |
33 |
| - - name: Set up Python 3.8 |
34 |
| - uses: actions/setup-python@v1 |
35 |
| - with: |
36 |
| - python-version: 3.8 |
37 |
| - - name: Checkout flask-restx code |
38 |
| - uses: actions/checkout@v2 |
39 |
| - with: |
40 |
| - path: base |
41 |
| - - name: Checkout flask-restx-feedstock code |
42 |
| - uses: actions/checkout@v2 |
43 |
| - with: |
44 |
| - repository: python-restx/flask-restx-feedstock.git |
45 |
| - path: feedstock |
46 |
| - token: ${{ secrets.BOT_TOKEN }} |
47 |
| - - name: Set Variables |
48 |
| - id: vars |
49 |
| - run: | |
50 |
| - echo "::set-output name=version::$(echo ${{ github.ref }} | cut -d'/' -f3)" |
51 |
| - - name: Create a release branch |
52 |
| - run: | |
53 |
| - cd feedstock |
54 |
| - git remote add forge https://github.com/conda-forge/flask-restx-feedstock.git |
55 |
| - git fetch forge |
56 |
| - git checkout forge/master -b release-${{ steps.vars.outputs.version }} |
57 |
| - - name: Update meta.yml |
58 |
| - shell: python |
59 |
| - run: | |
60 |
| - from http import client |
61 |
| - from pkg_resources import parse_requirements |
62 |
| - import re |
63 |
| - VERSION = "${{ steps.vars.outputs.version }}" |
64 |
| - with open("feedstock/recipe/meta.yaml") as f: |
65 |
| - meta = f.read() |
66 |
| - requirements = [] |
67 |
| - with open("base/requirements/install.pip") as f: |
68 |
| - for req in parse_requirements(f): |
69 |
| - name = req.project_name |
70 |
| - versions = ",".join(["".join(spec) for spec in req.specs]) |
71 |
| - if versions: |
72 |
| - name += " " + versions |
73 |
| - requirements.append(name) |
74 |
| - requirements = '"' + '", "'.join(requirements) + '"' |
75 |
| - conn = client.HTTPSConnection("pypi.org") |
76 |
| - conn.request("GET", "/simple/flask-restx/") |
77 |
| - resp = conn.getresponse() |
78 |
| - content = str(resp.read(), "utf-8") |
79 |
| - conn.close() |
80 |
| - m = re.findall(r'flask-restx-%s.tar.gz#sha256=([A-Za-z0-9]+)"' % VERSION, content) |
81 |
| - if not m: |
82 |
| - raise Exception("sha256 not found in: %s" % content) |
83 |
| - sha256 = m[0] |
84 |
| - meta = re.sub(r'({% set version = )".+"( %})', r'\1"%s"\2' % VERSION, meta) |
85 |
| - meta = re.sub(r'({% set sha256 = )".+"( %})', r'\1"%s"\2' % sha256, meta) |
86 |
| - meta = re.sub(r"({% set requirements = \[).+(] %})", r"\1%s\2" % requirements, meta) |
87 |
| - meta = re.sub(r"(number:) \d+", r"\1 0", meta) |
88 |
| - with open("feedstock/recipe/meta.yaml", "w") as f: |
89 |
| - f.write(meta) |
90 |
| - - name: Push |
91 |
| - run: | |
92 |
| - cd feedstock |
93 |
| - git config user.name "${{ secrets.BOT_USERNAME }}" |
94 |
| - git config user.email "[email protected]" |
95 |
| - git add recipe/meta.yaml |
96 |
| - git commit -m"Release version ${{ steps.vars.outputs.version }}" |
97 |
| - git push origin release-${{ steps.vars.outputs.version }} |
98 |
| - - name: Create Pull Request |
99 |
| - run: | |
100 |
| - curl --fail -u ${{ secrets.BOT_USERNAME }}:${{ secrets.BOT_TOKEN }} https://api.github.com/repos/conda-forge/flask-restx-feedstock/pulls -d '{"title": "Release version ${{ steps.vars.outputs.version }}", "head": "python-restx:release-${{ steps.vars.outputs.version }}", "base": "master", "maintainer_can_modify": true}' |
0 commit comments