-
-
Notifications
You must be signed in to change notification settings - Fork 542
84 lines (79 loc) · 3 KB
/
pre-release-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: 🎁 Release test pre-release version
on:
repository_dispatch:
types: [pre-release-command]
jobs:
pre-release:
name: Pre-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.client_payload.pull_request.head.sha }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install deps
run: |
python -m pip install pip --upgrade
pip install poetry
pip install githubrelease
pip install autopub
pip install httpx
- name: Check if release exists
id: check_release
run: echo "::set-output name=release::$(autopub check)"
- name: Metadata
id: metadata
if: steps.check_release.outputs.release == ''
run: echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Find Release Comment
uses: peter-evans/find-comment@v1
id: find_comment
if: steps.check_release.outputs.release == ''
with:
token: ${{ secrets.BOT_TOKEN }}
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
comment-author: botberry
body-includes: "# Pre-release"
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v1
if: steps.check_release.outputs.release == ''
with:
token: ${{ secrets.BOT_TOKEN }}
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
body: |
# Pre-release
:wave:
Releasing commit [${{ steps.metadata.outputs.commit }}] to PyPi as pre-release! :package:
edit-mode: replace
- name: Publish pre-release version
if: steps.check_release.outputs.release == ''
id: release
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: |
autopub prepare
poetry version $(poetry version -s).dev.$(date '+%s')
poetry build
poetry publish --username __token__
echo "::set-output name=version::$(poetry version -s)"
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v1
if: steps.check_release.outputs.release == ''
with:
token: ${{ secrets.BOT_TOKEN }}
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
body: |
# Pre-release
:wave:
Pre-release **${{ steps.release.outputs.version }}** [${{ steps.metadata.outputs.commit }}] has been released on PyPi! :rocket:
You can try it by doing:
```shell
poetry add strawberry-graphql==${{ steps.release.outputs.version }}
```
edit-mode: replace