Skip to content

Commit 7bb7c90

Browse files
chore: Release automatically when changed version.py (#232)
1 parent c1f668e commit 7bb7c90

File tree

1 file changed

+34
-29
lines changed

1 file changed

+34
-29
lines changed

.github/workflows/release.yaml

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,43 @@
1-
name: 'Release'
1+
name: "Release"
22

33
on:
4-
- workflow_dispatch
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- "posthog/version.py"
9+
workflow_dispatch:
510

611
jobs:
7-
release:
8-
name: Publish release
9-
runs-on: ubuntu-latest
10-
env:
11-
TWINE_USERNAME: __token__
12-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
13-
steps:
14-
- name: Checkout the repository
15-
uses: actions/checkout@v2
16-
with:
17-
fetch-depth: 0
18-
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
12+
release:
13+
name: Publish release
14+
runs-on: ubuntu-latest
15+
env:
16+
TWINE_USERNAME: __token__
17+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
18+
steps:
19+
- name: Checkout the repository
20+
uses: actions/checkout@v2
21+
with:
22+
fetch-depth: 0
23+
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
1924

20-
- name: Set up Python
21-
uses: actions/setup-python@v2
25+
- name: Set up Python
26+
uses: actions/setup-python@v2
2227

23-
- name: Detect version
24-
run: echo "REPO_VERSION=$(python3 posthog/version.py)" >> $GITHUB_ENV
28+
- name: Detect version
29+
run: echo "REPO_VERSION=$(python3 posthog/version.py)" >> $GITHUB_ENV
2530

26-
- name: Prepare for building release
27-
run: pip install -U pip setuptools wheel twine
31+
- name: Prepare for building release
32+
run: pip install -U pip setuptools wheel twine
2833

29-
- name: Push release to PyPI
30-
run: make release && make release_analytics
34+
- name: Push release to PyPI
35+
run: make release && make release_analytics
3136

32-
- name: Create GitHub release
33-
uses: actions/create-release@v1
34-
env:
35-
GITHUB_TOKEN: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
36-
with:
37-
tag_name: v${{ env.REPO_VERSION }}
38-
release_name: ${{ env.REPO_VERSION }}
37+
- name: Create GitHub release
38+
uses: actions/create-release@v1
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
41+
with:
42+
tag_name: v${{ env.REPO_VERSION }}
43+
release_name: ${{ env.REPO_VERSION }}

0 commit comments

Comments
 (0)