Skip to content

Commit c71c869

Browse files
authored
ci: Add support for semantic release (feast-dev#2332)
* Add support for semantic release Signed-off-by: Willem Pienaar <[email protected]> * Fix typos Signed-off-by: Willem Pienaar <[email protected]> * Require a Personal Access Token Signed-off-by: Willem Pienaar <[email protected]>
1 parent 23a1c05 commit c71c869

File tree

4 files changed

+320
-198
lines changed

4 files changed

+320
-198
lines changed

.github/workflows/publish.yml

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
get-version:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
release_version: ${{ steps.get_release_version.outputs.release_version }}
13+
version_without_prefix: ${{ steps.get_release_version_without_prefix.outputs.version_without_prefix }}
14+
highest_semver_tag: ${{ steps.get_highest_semver.outputs.highest_semver_tag }}
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Get release version
18+
id: get_release_version
19+
run: echo ::set-output name=release_version::${GITHUB_REF#refs/*/}
20+
- name: Get release version without prefix
21+
id: get_release_version_without_prefix
22+
env:
23+
RELEASE_VERSION: ${{ steps.get_release_version.outputs.release_version }}
24+
run: |
25+
echo ::set-output name=version_without_prefix::${RELEASE_VERSION:1}
26+
- name: Get highest semver
27+
id: get_highest_semver
28+
env:
29+
RELEASE_VERSION: ${{ steps.get_release_version.outputs.release_version }}
30+
run: |
31+
source infra/scripts/setup-common-functions.sh
32+
SEMVER_REGEX='^v[0-9]+\.[0-9]+\.[0-9]+(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$'
33+
if echo "${RELEASE_VERSION}" | grep -P "$SEMVER_REGEX" &>/dev/null ; then
34+
echo ::set-output name=highest_semver_tag::$(get_tag_release -m)
35+
fi
36+
- name: Check output
37+
env:
38+
RELEASE_VERSION: ${{ steps.get_release_version.outputs.release_version }}
39+
VERSION_WITHOUT_PREFIX: ${{ steps.get_release_version_without_prefix.outputs.version_without_prefix }}
40+
HIGHEST_SEMVER_TAG: ${{ steps.get_highest_semver.outputs.highest_semver_tag }}
41+
run: |
42+
echo $RELEASE_VERSION
43+
echo $VERSION_WITHOUT_PREFIX
44+
echo $HIGHEST_SEMVER_TAG
45+
46+
build-publish-docker-images:
47+
runs-on: ubuntu-latest
48+
needs: get-version
49+
strategy:
50+
matrix:
51+
component: [feature-server-python-aws, feature-server-java, feature-transformation-server]
52+
env:
53+
MAVEN_CACHE: gs://feast-templocation-kf-feast/.m2.2020-08-19.tar
54+
REGISTRY: feastdev
55+
steps:
56+
- uses: actions/checkout@v2
57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v1
59+
- name: Set up Docker Buildx
60+
uses: docker/setup-buildx-action@v1
61+
- name: Login to DockerHub
62+
uses: docker/login-action@v1
63+
with:
64+
username: ${{ secrets.DOCKERHUB_USERNAME }}
65+
password: ${{ secrets.DOCKERHUB_TOKEN }}
66+
- name: Set up Cloud SDK
67+
uses: google-github-actions/setup-gcloud@master
68+
with:
69+
project_id: ${{ secrets.GCP_PROJECT_ID }}
70+
service_account_key: ${{ secrets.GCP_SA_KEY }}
71+
export_default_credentials: true
72+
- name: Use gcloud CLI
73+
run: gcloud info
74+
- run: gcloud auth configure-docker --quiet
75+
- name: Get m2 cache
76+
run: |
77+
infra/scripts/download-maven-cache.sh \
78+
--archive-uri ${MAVEN_CACHE} \
79+
--output-dir .
80+
- name: Build image
81+
run: |
82+
make build-${{ matrix.component }}-docker REGISTRY=${REGISTRY} VERSION=${VERSION_WITHOUT_PREFIX}
83+
env:
84+
RELEASE_VERSION: ${{ needs.get-version.outputs.release_version }}
85+
VERSION_WITHOUT_PREFIX: ${{ needs.get-version.outputs.version_without_prefix }}
86+
HIGHEST_SEMVER_TAG: ${{ needs.get-version.outputs.highest_semver_tag }}
87+
- name: Push versioned images
88+
env:
89+
RELEASE_VERSION: ${{ needs.get-version.outputs.release_version }}
90+
VERSION_WITHOUT_PREFIX: ${{ needs.get-version.outputs.version_without_prefix }}
91+
HIGHEST_SEMVER_TAG: ${{ needs.get-version.outputs.highest_semver_tag }}
92+
run: |
93+
make push-${{ matrix.component }}-docker REGISTRY=${REGISTRY} VERSION=${VERSION_WITHOUT_PREFIX}
94+
95+
echo "Only push to latest tag if tag is the highest semver version $HIGHEST_SEMVER_TAG"
96+
if [ "${VERSION_WITHOUT_PREFIX}" = "${HIGHEST_SEMVER_TAG:1}" ]
97+
then
98+
docker tag feastdev/${{ matrix.component }}:${VERSION_WITHOUT_PREFIX} feastdev/${{ matrix.component }}:latest
99+
docker push feastdev/${{ matrix.component }}:latest
100+
fi
101+
102+
publish-helm-charts:
103+
runs-on: ubuntu-latest
104+
needs: get-version
105+
env:
106+
HELM_VERSION: v3.8.0
107+
VERSION_WITHOUT_PREFIX: ${{ needs.get-version.outputs.version_without_prefix }}
108+
steps:
109+
- uses: actions/checkout@v2
110+
- uses: google-github-actions/setup-gcloud@master
111+
with:
112+
version: '290.0.1'
113+
export_default_credentials: true
114+
project_id: ${{ secrets.GCP_PROJECT_ID }}
115+
service_account_key: ${{ secrets.GCP_SA_KEY }}
116+
- run: gcloud auth configure-docker --quiet
117+
- name: Remove previous Helm
118+
run: sudo rm -rf $(which helm)
119+
- name: Install Helm
120+
run: ./infra/scripts/helm/install-helm.sh
121+
- name: Validate Helm chart prior to publishing
122+
run: ./infra/scripts/helm/validate-helm-chart-publish.sh
123+
- name: Validate all version consistency
124+
run: ./infra/scripts/helm/validate-helm-chart-versions.sh $VERSION_WITHOUT_PREFIX
125+
- name: Publish Helm charts
126+
run: ./infra/scripts/helm/push-helm-charts.sh $VERSION_WITHOUT_PREFIX
127+
128+
publish-python-sdk:
129+
runs-on: ubuntu-latest
130+
env:
131+
TWINE_USERNAME: __token__
132+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
133+
container: python:3.7
134+
steps:
135+
- uses: actions/checkout@v2
136+
- name: Install pip-tools
137+
run: pip install pip-tools
138+
- name: Install dependencies
139+
run: make install-python-ci-dependencies PYTHON=3.7
140+
- name: Publish Python Package
141+
run: |
142+
cd sdk/python
143+
python3 -m pip install --user --upgrade setuptools wheel twine
144+
python3 setup.py sdist bdist_wheel
145+
python3 -m twine upload --verbose dist/*
146+
147+
publish-python-sdk-no-telemetry:
148+
runs-on: ubuntu-latest
149+
needs: get-version
150+
env:
151+
TWINE_USERNAME: __token__
152+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
153+
container: python:3.7
154+
steps:
155+
- uses: actions/checkout@v2
156+
- name: Install pip-tools
157+
run: pip install pip-tools
158+
- name: Install dependencies
159+
run: make install-python-ci-dependencies PYTHON=3.7
160+
- name: Publish Python Package
161+
env:
162+
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ needs.get-version.outputs.version_without_prefix }}
163+
run: |
164+
cd sdk/python
165+
sed -i 's/DEFAULT_FEAST_USAGE_VALUE = "True"/DEFAULT_FEAST_USAGE_VALUE = "False"/g' feast/constants.py
166+
sed -i 's/NAME = "feast"/NAME = "feast-no-telemetry"/g' setup.py
167+
python3 -m pip install --user --upgrade setuptools wheel twine
168+
python3 setup.py sdist bdist_wheel
169+
python3 -m twine upload --verbose dist/*
170+
171+
publish-java-sdk:
172+
container: maven:3.6-jdk-11
173+
runs-on: ubuntu-latest
174+
needs: get-version
175+
steps:
176+
- uses: actions/checkout@v2
177+
with:
178+
submodules: 'true'
179+
- name: Set up JDK 11
180+
uses: actions/setup-java@v1
181+
with:
182+
java-version: '11'
183+
java-package: jdk
184+
architecture: x64
185+
- uses: actions/setup-python@v2
186+
with:
187+
python-version: '3.7'
188+
architecture: 'x64'
189+
- uses: actions/cache@v2
190+
with:
191+
path: ~/.m2/repository
192+
key: ${{ runner.os }}-it-maven-${{ hashFiles('**/pom.xml') }}
193+
restore-keys: |
194+
${{ runner.os }}-it-maven-
195+
- name: Publish java sdk
196+
env:
197+
VERSION_WITHOUT_PREFIX: ${{ needs.get-version.outputs.version_without_prefix }}
198+
GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
199+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
200+
MAVEN_SETTINGS: ${{ secrets.MAVEN_SETTINGS }}
201+
run: |
202+
echo -n "$GPG_PUBLIC_KEY" > /root/public-key
203+
echo -n "$GPG_PRIVATE_KEY" > /root/private-key
204+
mkdir -p /root/.m2/
205+
echo -n "$MAVEN_SETTINGS" > /root/.m2/settings.xml
206+
infra/scripts/publish-java-sdk.sh --revision ${VERSION_WITHOUT_PREFIX} --gpg-key-import-dir /root

0 commit comments

Comments
 (0)