forked from chroma-core/chroma
-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (120 loc) · 4.07 KB
/
chroma-release.yml
File metadata and controls
123 lines (120 loc) · 4.07 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Chroma Release
on:
push:
tags:
- '*'
branches:
- main
env:
REGISTRY: ghcr.io
IMAGE_NAME: "ghcr.io/chroma-core/chroma"
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions: write-all
# id-token: write
# contents: read
# deployments: write
# packages: write
# pull-requests: read
# statuses: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Client Dev Dependencies
run: python -m pip install -r requirements_dev.txt
- name: Build Client
run: python -m build
- name: Test Client Package
run: bin/test-package.sh dist/*.tar.gz
- name: Log in to the Container registry
uses: docker/login-action@v2.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install setuptools_scm
run: python -m pip install setuptools_scm
- name: Get Docker Tag
id: tag
run: echo "tag_name=$IMAGE_NAME:$(bin/version)" >> $GITHUB_OUTPUT
- name: Build and push prerelease Docker image
if: "!startsWith(github.ref, 'refs/tags/')"
uses: docker/build-push-action@v3.2.0
with:
context: .
push: true
tags: ${{ steps.tag.outputs.tag_name}}
- name: Build and push release Docker image
if: "startsWith(github.ref, 'refs/tags/')"
uses: docker/build-push-action@v3.2.0
with:
context: .
push: true
tags: "${{ steps.tag.outputs.tag_name }},${{ env.IMAGE_NAME }}:latest"
- name: Get Release Version
id: version
run: echo "version=$(python -m setuptools_scm)" >> $GITHUB_OUTPUT
- name: Get current date
id: builddate
run: echo "builddate=$(date +'%Y-%m-%dT%H:%M')" >> $GITHUB_OUTPUT
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Login to AWS
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::369178033109:role/github-action-generate-cf-template
aws-region: us-east-1
- name: Generate CloudFormation template
id: generate-cf
if: "startsWith(github.ref, 'refs/tags/')"
run: "pip install boto3 && python bin/generate_cloudformation.py"
- name: Release Tagged Version
uses: ncipollo/release-action@v1.11.1
if: "startsWith(github.ref, 'refs/tags/')"
with:
body: |
Version: `${{steps.version.outputs.version}}`
Git ref: `${{github.ref}}`
Build Date: `${{steps.builddate.outputs.builddate}}`
PIP Package: `chroma-${{steps.version.outputs.version}}.tar.gz`
Docker Image: `${{steps.tag.outputs.tag_name}}`
artifacts: "dist/chroma-${{steps.version.outputs.version}}.tar.gz"
prerelease: true
generateReleaseNotes: true
- name: Update Tag
uses: richardsimko/update-tag@v1.0.5
if: "!startsWith(github.ref, 'refs/tags/')"
with:
tag_name: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release Latest
uses: ncipollo/release-action@v1.11.1
if: "!startsWith(github.ref, 'refs/tags/')"
with:
tag: "latest"
name: "Latest"
body: |
Version: `${{steps.version.outputs.version}}`
Git ref: `${{github.ref}}`
Build Date: `${{steps.builddate.outputs.builddate}}`
PIP Package: `chroma-${{steps.version.outputs.version}}.tar.gz`
Docker Image: `${{steps.tag.outputs.tag_name}}`
artifacts: "dist/chroma-${{steps.version.outputs.version}}.tar.gz"
allowUpdates: true
prerelease: true