-
Notifications
You must be signed in to change notification settings - Fork 572
120 lines (106 loc) · 4.38 KB
/
Copy pathpublish_release_packages.yml
File metadata and controls
120 lines (106 loc) · 4.38 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
name: Build and publish release packages
on:
push:
tags:
- "v*"
permissions:
contents: read
jobs:
build-lambda:
name: Build Lambda ARM64
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
outputs:
artifact-name: ${{ steps.set-artifact-name.outputs.name }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Extract asset version
run: echo "ASSET_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- 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: Set artifact name
id: set-artifact-name
run: echo "name=lambda-zip-${{ env.ASSET_VERSION }}" >> $GITHUB_OUTPUT
- name: Upload Lambda zip as workflow artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ steps.set-artifact-name.outputs.name }}
path: quickwit-aws-lambda-${{ env.ASSET_VERSION }}-aarch64.zip
retention-days: 3
build-macos-binaries:
name: Build ${{ matrix.target }}
runs-on: macos-latest
needs: [build-lambda]
permissions:
contents: write
actions: write
strategy:
matrix:
target: [x86_64-apple-darwin, aarch64-apple-darwin]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Extract asset version
run: echo "ASSET_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Download Lambda artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ needs.build-lambda.outputs.artifact-name }}
path: /tmp/lambda-artifact
- name: Set LAMBDA_ZIP_PATH
run: echo "LAMBDA_ZIP_PATH=$(ls /tmp/lambda-artifact/*.zip)" >> $GITHUB_ENV
- uses: ./.github/actions/cargo-build-macos-binary
with:
target: ${{ matrix.target }}
version: ${{ env.ASSET_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
build-linux-binaries:
strategy:
matrix:
target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]
name: Build ${{ matrix.target }}
runs-on: ubuntu-latest
needs: [build-lambda]
permissions:
contents: write
actions: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Extract asset version
run: echo "ASSET_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Download Lambda artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ needs.build-lambda.outputs.artifact-name }}
# `cross` mounts the Rust workspace (`quickwit/`) at `/project` in the container.
path: ./quickwit/lambda-artifact
- name: Set LAMBDA_ZIP_PATH
run: |
ZIP=$(ls quickwit/lambda-artifact/*.zip)
echo "LAMBDA_ZIP_PATH=/project/lambda-artifact/$(basename "$ZIP")" >> "$GITHUB_ENV"
- uses: ./.github/actions/cross-build-binary
with:
target: ${{ matrix.target }}
version: ${{ env.ASSET_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}