forked from quickwit-oss/quickwit
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (68 loc) · 2.82 KB
/
publish_lambda.yaml
File metadata and controls
78 lines (68 loc) · 2.82 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
# This workflow creates a new release for a quickwit search aws lambda.
# The artifact is a zip file containing a binary for ARM 64,
# ready to be deployed by the deployer.
#
# See quickwit-lambda-client/README.md
name: Release Lambda binary
on:
push:
tags:
- 'lambda-*'
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g., v0.8.0)'
required: false
default: 'dev'
permissions:
contents: read
jobs:
build-lambda:
name: Build Lambda ARM64
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set version
run: |
if [ "${{ github.ref_type }}" = "tag" ]; then
# Extract version from tag (e.g., lambda-v0.8.0 -> v0.8.0)
echo "ASSET_VERSION=${GITHUB_REF_NAME#lambda-}" >> $GITHUB_ENV
elif [ -n "${{ github.event.inputs.version }}" ] && [ "${{ github.event.inputs.version }}" != "dev" ]; then
echo "ASSET_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
else
echo "ASSET_VERSION=dev-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
fi
- name: Install rustup
run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y
- name: Install cross
run: cargo install cross
- name: Retrieve and export commit date, hash, and tags
run: |
echo "QW_COMMIT_DATE=$(TZ=UTC0 git log -1 --format=%cd --date=format-local:%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV
echo "QW_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "QW_COMMIT_TAGS=$(git tag --points-at HEAD | tr '\n' ',')" >> $GITHUB_ENV
- name: Build Lambda binary
run: cross build --release --features lambda-release --target aarch64-unknown-linux-gnu -p quickwit-lambda-server --bin quickwit-aws-lambda-leaf-search
env:
QW_COMMIT_DATE: ${{ env.QW_COMMIT_DATE }}
QW_COMMIT_HASH: ${{ env.QW_COMMIT_HASH }}
QW_COMMIT_TAGS: ${{ env.QW_COMMIT_TAGS }}
working-directory: ./quickwit
- name: Create Lambda zip
run: |
cd quickwit/target/aarch64-unknown-linux-gnu/release
cp quickwit-aws-lambda-leaf-search bootstrap
zip quickwit-aws-lambda-${{ env.ASSET_VERSION }}-aarch64.zip bootstrap
mv quickwit-aws-lambda-${{ env.ASSET_VERSION }}-aarch64.zip ../../../../
- name: Upload to GitHub release
uses: quickwit-inc/upload-to-github-release@9b2c40fba23bf8dea05b7d2eece24cbc95d4a190
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: quickwit-aws-lambda-${{ env.ASSET_VERSION }}-aarch64.zip
overwrite: true
draft: true
tag_name: ${{ env.ASSET_VERSION }}