-
Notifications
You must be signed in to change notification settings - Fork 3
52 lines (46 loc) · 1.84 KB
/
binary.yml
File metadata and controls
52 lines (46 loc) · 1.84 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
name: Build Binary
on:
push:
tags:
- v*
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Generate App Version
run: |
TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
if [ -n "$TAG" ]; then
echo "APP_VERSION=$TAG" >> $GITHUB_ENV
else
BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's#[^a-zA-Z0-9._-]#-#g')
COMMIT=$(git rev-parse --short HEAD)
echo "APP_VERSION=${BRANCH}-${COMMIT}" >> $GITHUB_ENV
fi
- name: Set up Centos 7 environment
run: |
sudo docker pull centos:7
sudo docker run -v ${{ github.workspace }}:/workspace -w /workspace centos:7 /bin/bash -c "
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* &&
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* &&
yum -y update &&
yum -y install gcc make wget &&
wget https://go.dev/dl/go1.21.0.linux-amd64.tar.gz &&
rm -rf /usr/local/go &&
tar -C /usr/local -xzf go1.21.0.linux-amd64.tar.gz &&
export PATH=$PATH:/usr/local/go/bin &&
make package
"
- name: Upload to OSS
env:
OSS_ACCESS_KEY_ID: ${{ secrets.OSS_ACCESS_KEY_ID }}
OSS_ACCESS_KEY_SECRET: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
OSS_BUCKET: apo-oss
OSS_ENDPOINT: https://oss-cn-hangzhou.aliyuncs.com/
run: |
curl https://gosspublic.alicdn.com/ossutil/install.sh | sudo bash
sudo ossutil config -e $OSS_ENDPOINT -i $OSS_ACCESS_KEY_ID -k $OSS_ACCESS_KEY_SECRET -L CH -c /root/.ossutilconfig
sudo ossutil cp dist/node-agent.tar.gz oss://$OSS_BUCKET/node-agent-linux-amd64-${{ env.APP_VERSION }}.tar.gz