-
Notifications
You must be signed in to change notification settings - Fork 4
73 lines (64 loc) · 2.19 KB
/
bin-build.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
name: Binary build
on:
workflow_call:
inputs:
ref:
required: false
type: string
tag:
required: false
type: string
permissions: write-all
jobs:
build-bin:
strategy:
matrix:
go_arch: [amd64, arm64]
go_version: [1.19.x]
name: Binary Build ${{ matrix.go_arch }}
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Get Upload
id: tag
run: |
if ${{ inputs.ref != '' }} ; then
echo "call by workflow_call(e2e)"
echo "upload=true" >> $GITHUB_OUTPUT
echo "tag=dev" >> $GITHUB_OUTPUT
elif ${{ inputs.tag != '' }} ; then
echo "call by workflow_call(release push)"
echo "upload=true" >> $GITHUB_OUTPUT
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'push' }} ; then
echo "trigger by push"
echo "upload=false" >> $GITHUB_OUTPUT
echo "tag=main" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'pull_request_target' }} ; then
echo "trigger by pull_request_target"
echo "upload=false" >> $GITHUB_OUTPUT
echo "tag=dev" >> $GITHUB_OUTPUT
else
echo "unexpected event: ${{ github.event_name }}"
exit 1
fi
- name: Build
run: |
make build ARCH=${{ matrix.go_arch }} GIT_TAG=${{ steps.tag.outputs.tag }}
if [ "${{ steps.tag.outputs.upload }}" == "true" ]; then
sudo mkdir -p /home/spider/
cd ./.tmp/bin
sudo tar -cvzf /home/spider/spider-plugins-linux-${{ matrix.go_arch }}-${{ steps.tag.outputs.tag }}.tar *
fi
- name: Upload Binary artifact
if: ${{ steps.tag.outputs.upload == 'true' }}
uses: actions/[email protected]
with:
name: binary_files
path: /home/spider/spider-plugins-linux-${{ matrix.go_arch }}-${{ steps.tag.outputs.tag }}.tar
retention-days: 1