This repository has been archived by the owner on Aug 25, 2024. It is now read-only.
forked from LangStream/langstream
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (60 loc) · 2.38 KB
/
release.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
name: Release
on:
push:
tags:
- 'vectorize*'
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Init maven repo
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build
run: |
chmod +x mvnw
./docker/build.sh
- name: Deploy docker images
run: |
NEW_TAG=${GITHUB_REF/refs\/tags\/vectorize-/}
IMAGE_PREFIX="langstream/langstream"
SOURCE_TAG="latest-dev"
TARGET_PREFIX="891377311292.dkr.ecr.us-east-1.amazonaws.com/vectorize"
# Login to AWS ECR
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 891377311292.dkr.ecr.us-east-1.amazonaws.com
# List and filter images, then re-tag and push them
docker images --format "{{.Repository}}:{{.Tag}}" | egrep "^${IMAGE_PREFIX}.*:${SOURCE_TAG}$" | while read -r image; do
# Extract the trailing text between prefix and tag
trailing_text=$(echo "$image" | sed "s|^${IMAGE_PREFIX}\(.*\):${SOURCE_TAG}$|\1|")
# Construct the new image name
new_image="${TARGET_PREFIX}${trailing_text}:${NEW_TAG}"
echo "Re-tagging $image to $new_image"
# Tag the image with the new name and tag
docker tag "$image" "$new_image"
# Push the image
docker push "$new_image"
done
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- uses: ncipollo/release-action@v1
with:
artifacts: "langstream-cli/target/langstream-*.zip,helm/crds/*.yml,langstream-webservice/target/api.json"
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
prerelease: false