-
Notifications
You must be signed in to change notification settings - Fork 122
182 lines (172 loc) · 7.78 KB
/
publish_indexify_server.yaml
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: Publish Indexify Binaries
on:
workflow_dispatch:
inputs:
release_message:
type: string
description: Release message
required: true
prerelease:
type: boolean
description: Is this a pre-release version?
required: false
default: false
ref:
type: string
description: The ref to checkout before running the workflow
required: false
default: main
permissions:
contents: write
actions: write
packages: write
env:
CARGO_TERM_COLOR: always
defaults:
run:
working-directory: ./server
jobs:
build-release-packages:
uses: ./.github/workflows/wf_build_indexify_server_release_packages.yaml
extract-version:
name: Extract Version Number
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version_extraction.outputs.version }}
steps:
- uses: actions/checkout@v4
- id: version_extraction
run: echo "version=$(cargo metadata --format-version 1 | jq '.packages[] | select(.name == "indexify-server") | .version' | xargs)" >> "$GITHUB_OUTPUT"
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs:
- build-release-packages
- extract-version
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- run: mkdir -p /tmp/release
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: /tmp/release/
- name: Name Artifacts
run: |
# mv /tmp/release/indexify-server-windows-amd64.exe/indexify-server.exe /tmp/release/indexify-server-${{ needs.extract-version.outputs.version }}-windows-amd64.exe
mv /tmp/release/indexify-server-darwin-arm64/indexify-server /tmp/release/indexify-server-${{ needs.extract-version.outputs.version }}-darwin-arm64
# mv /tmp/release/indexify-server-darwin-amd64/indexify-server /tmp/release/indexify-server-${{ needs.extract-version.outputs.version }}-darwin-amd64
mv /tmp/release/indexify-server-linux-amd64/indexify-server /tmp/release/indexify-server-${{ needs.extract-version.outputs.version }}-linux-amd64
mv /tmp/release/indexify-server-deb-linux-amd64/indexify-server_${{ needs.extract-version.outputs.version }}-1_amd64.deb /tmp/release/indexify-server-${{ needs.extract-version.outputs.version }}-linux-amd64.deb
mv /tmp/release/indexify-server-deb-linux-aarch64/indexify-server_${{ needs.extract-version.outputs.version }}-1_arm64.deb /tmp/release/indexify-server-${{ needs.extract-version.outputs.version }}-linux-arm64.deb
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: "v${{ needs.extract-version.outputs.version }}"
prerelease: ${{ github.event.inputs.prerelease }}
body: ${{ github.event.inputs.release_message }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#- name: Upload Windows Binary
# uses: actions/upload-release-asset@v1
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: /tmp/release/indexify-server-${{ needs.extract-version.outputs.version }}-windows-amd64.exe
# asset_name: indexify-server-${{ needs.extract-version.outputs.version }}-windows-amd64.exe
# asset_content_type: application/octet-stream
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Linux Binary
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /tmp/release/indexify-server-${{ needs.extract-version.outputs.version }}-linux-amd64
asset_name: indexify-server-${{ needs.extract-version.outputs.version }}-linux-amd64
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload macOS Binary
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /tmp/release/indexify-server-${{ needs.extract-version.outputs.version }}-darwin-arm64
asset_name: indexify-server-${{ needs.extract-version.outputs.version }}-darwin-arm64
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Upload macOS x86 Binary
# uses: actions/upload-release-asset@v1
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: /tmp/release/indexify-server-${{ needs.extract-version.outputs.version }}-darwin-amd64
# asset_name: indexify-server-${{ needs.extract-version.outputs.version }}-darwin-amd64
# asset_content_type: application/octet-stream
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Linux Deb Package for amd64
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /tmp/release/indexify-server-${{ needs.extract-version.outputs.version }}-linux-amd64.deb
asset_name: indexify-server-${{ needs.extract-version.outputs.version }}-linux-amd64.deb
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Linux Deb Package for arm64
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /tmp/release/indexify-server-${{ needs.extract-version.outputs.version }}-linux-arm64.deb
asset_name: indexify-server-${{ needs.extract-version.outputs.version }}-linux-arm64.deb
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: install reprepro
run: sudo apt-get update && sudo apt-get install -y reprepro
- name: Run reprepro
run: |
ls /tmp/release/
(cd .repo && reprepro includedeb buster /tmp/release/*.deb)
(cd .repo && reprepro includedeb focal /tmp/release/*.deb)
(cd .repo && reprepro includedeb jammy /tmp/release/*.deb)
# (cd .repo && reprepro includedeb noble /tmp/release/*.deb)
ls .repo/
- uses: ryand56/r2-upload-action@latest
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: server/.repo/
destination-dir: ./repo
build-and-push-docker-images:
name: Build and Push Docker Images
runs-on: ubuntu-latest
needs:
- extract-version
- create-release
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: |
docker buildx build --platform=linux/amd64,linux/arm64 --push . -t tensorlake/indexify-server:latest -f dockerfiles/Dockerfile.release_server;
tag="";
for i in $(echo ${{ needs.extract-version.outputs.version }} | tr '.' '\n')
do
if [[ $tag == "" ]]; then
tag="$i";
else
tag="$tag.$i";
fi
docker buildx build --platform=linux/amd64,linux/arm64 --push . -t tensorlake/indexify-server:$tag -f dockerfiles/Dockerfile.release_server;
done