forked from cnosdb/cnosdb
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (111 loc) · 3.95 KB
/
build_package_and_push.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
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
name: Build package and push
permissions:
contents: write
on:
push:
tags:
- v[0-9]+.*
workflow_dispatch:
inputs:
tag:
description: 'tag(with "v")'
required: true
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
target:
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
steps:
- name: Get tag
id: get-tag
run: |
if [[ "${{ github.event_name }}" = "workflow_dispatch" ]]; then
echo "TAG=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "TAG=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Set up cargo-zigbuild
shell: bash
run: |
curl -o zig.tar.xz -sL https://ziglang.org/download/0.11.0/zig-linux-x86_64-0.11.0.tar.xz
sudo tar -xf zig.tar.xz -C /opt
echo "/opt/zig-linux-x86_64-0.11.0" >> $GITHUB_PATH
cargo install cargo-zigbuild
- uses: actions/checkout@v3
- name: Install dependencies
shell: bash
run: |
TARGETPLATFORM="linux/amd64" bash ./.github/tools/install_dependencies.sh
- name: Install build tools
shell: bash
run: |
sudo gem install fpm
- name: Compiler
run: |
rustup target add ${{ matrix.target }}
cargo zigbuild --workspace --bins --release --target ${{ matrix.target }}.2.17
- name: Package
run: |
bash -x ./packages/build_package.sh -n cnosdb -v ${{ steps.get-tag.outputs.TAG }} -b release -t ${{ matrix.target }}
bash -x ./packages/build_package.sh -n cnosdb-meta -v ${{ steps.get-tag.outputs.TAG }} -b release -t ${{ matrix.target }}
- name: Setup Ossutil
uses: manyuanrong/[email protected]
with:
endpoint: "oss-cn-beijing.aliyuncs.com"
access-key-id: ${{ secrets.PACKAGING_OSS_ACCESS_KEY }}
access-key-secret: ${{ secrets.PACKAGING_OSS_ACCESS_KEY_SECRET }}
- name: Upload to Oss
shell: bash
run: |
touch uploading
ossutil cp -f ./uploading oss://tk3stzc21/uploading
ossutil cp -rf ./ oss://tk3stzc21/temp/ --include "*.rpm" --include "*.deb"
ossutil rm -f oss://tk3stzc21/uploading
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
*.deb
*.rpm
tag_name: ${{ steps.get-tag.outputs.TAG }}
build-windows:
runs-on: windows-latest
steps:
- name: Get tag
id: get-tag
shell: bash
run: |
if [[ "${{ github.event_name }}" = "workflow_dispatch" ]]; then
echo "TAG=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "TAG=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- uses: actions/checkout@v3
- name: Install Dependencies
shell: bash
run: |
TARGETPLATFORM="windows/amd64" bash ./.github/tools/install_dependencies.sh
- name: Compiler
run: cargo build --workspace --bins --release --target x86_64-pc-windows-msvc
- name: Package
run: |
New-Item -ItemType Directory -Path .\windows
Copy-Item -Path .\target\x86_64-pc-windows-msvc\release\cnosdb.exe -Destination .\windows\cnosdb.exe
Copy-Item -Path .\target\x86_64-pc-windows-msvc\release\cnosdb-meta.exe -Destination .\windows\cnosdb-meta.exe
Copy-Item -Path .\target\x86_64-pc-windows-msvc\release\cnosdb-cli.exe -Destination .\windows\cnosdb-cli.exe
Copy-Item -Path .\config\config.toml -Destination .\windows\cnosdb.conf
Copy-Item -Path .\meta\config\config.toml -Destination .\windows\cnosdb-meta.conf
$tag = "${{ steps.get-tag.outputs.TAG }}"
$version = $tag.substring(1)
Compress-Archive -Path .\windows\* -Destination .\cnosdb-community-${version}-windows_x86_64.zip
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
*windows_x86_64.zip
tag_name: ${{ steps.get-tag.outputs.TAG }}