Add amplitude release (#1720)
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
parent
638e9f9477
commit
941f4097fe
4 changed files with 47 additions and 4 deletions
|
@ -1,9 +1,9 @@
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
message:
|
discord_release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Discord Webhook Action
|
- name: Discord Webhook Action
|
||||||
|
@ -19,4 +19,15 @@ jobs:
|
||||||
### Changelog
|
### Changelog
|
||||||
|
|
||||||
${{ github.event.release.body }}
|
${{ github.event.release.body }}
|
||||||
```
|
```
|
||||||
|
amplitude_release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: "3.10.5"
|
||||||
|
architecture: "x64"
|
||||||
|
cache: "pip"
|
||||||
|
- run: pip install -r script/amplitude_release/requirements.txt
|
||||||
|
- run: python script/amplitude_release/main.py ${{ github.event.release.tag_name }} ${{ secrets.ZED_AMPLITUDE_API_KEY }} ${{ secrets.ZED_AMPLITUDE_SECRET_KEY }}
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -8,4 +8,5 @@
|
||||||
/vendor/bin
|
/vendor/bin
|
||||||
/assets/themes/*.json
|
/assets/themes/*.json
|
||||||
/assets/themes/internal/*.json
|
/assets/themes/internal/*.json
|
||||||
/assets/themes/experiments/*.json
|
/assets/themes/experiments/*.json
|
||||||
|
**/venv
|
30
script/amplitude_release/main.py
Normal file
30
script/amplitude_release/main.py
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
import datetime
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from amplitude_python_sdk.v2.clients.releases_client import ReleasesAPIClient
|
||||||
|
from amplitude_python_sdk.v2.models.releases import Release
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
version = sys.argv[1]
|
||||||
|
version = version.removeprefix("v")
|
||||||
|
|
||||||
|
api_key = sys.argv[2]
|
||||||
|
secret_key = sys.argv[3]
|
||||||
|
|
||||||
|
current_datetime = datetime.datetime.now(datetime.timezone.utc)
|
||||||
|
current_datetime = current_datetime.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
|
||||||
|
release = Release(
|
||||||
|
title=version,
|
||||||
|
version=version,
|
||||||
|
release_start=current_datetime,
|
||||||
|
created_by="GitHub Release Workflow",
|
||||||
|
chart_visibility=True
|
||||||
|
)
|
||||||
|
|
||||||
|
ReleasesAPIClient(api_key=api_key, secret_key=secret_key).create(release)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
1
script/amplitude_release/requirements.txt
Normal file
1
script/amplitude_release/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
amplitude-python-sdk==0.2.0
|
Loading…
Add table
Add a link
Reference in a new issue