-
Notifications
You must be signed in to change notification settings - Fork 4
69 lines (59 loc) · 2.96 KB
/
update-ckb.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
name: Update CKB
on:
schedule:
- cron: '0 4 * * *' # 在北京时间每天的12点触发
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: nervosnetwork/ckb
ref: develop
- name: Update ckb
id: UpdateCkb
run: |
wget http://github-test-logs.ckbapp.dev/ckb/bin/ckb-develop-x86_64-unknown-linux-gnu-portable.tar.gz
tar -zxvf ckb-develop-x86_64-unknown-linux-gnu-portable.tar.gz
ckb_version=$(./ckb-develop-x86_64-unknown-linux-gnu-portable/ckb --version | sed 's/.* (\(.*\) .*)/\1/')
git_hash=$(git log -1 --format='%H' | cut -c 1-7)
echo ${git_hash}
echo ${ckb_version}
# 比较版本号和哈希值
if [ "$ckb_version" == "$git_hash" ]; then
echo "版本号与哈希值相匹配。"
echo "::set-output name=compare_result::false" # 或者根据上一个步骤的执行结果设置 compare_result
echo "compare_result=false" >> $GITHUB_OUTPUT
else
echo "版本号与哈希值不匹配。"
echo "备份老版本"
mv ckb-develop-x86_64-unknown-linux-gnu-portable ckb-latest-x86_64-unknown-linux-gnu-portable
tar -zcvf ckb-latest-x86_64-unknown-linux-gnu-portable.tar.gz ckb-latest-x86_64-unknown-linux-gnu-portable
echo "设置上传到七牛云"
echo "备份新版本"
export GIT_TAG_NAME=` echo ${{ github.ref }} | awk -F '/' '{print $4}' `
docker run --rm -i -w /ckb -v $(pwd):/ckb -e OPENSSL_STATIC=1 -e OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu -e OPENSSL_INCLUDE_DIR=/usr/include nervos/ckb-docker-builder:bionic-rust-1.67.1 make prod_portable
cp target/prod/ckb ckb-latest-x86_64-unknown-linux-gnu-portable/ckb
mv ckb-latest-x86_64-unknown-linux-gnu-portable ckb-develop-x86_64-unknown-linux-gnu-portable
tar -zcvf ckb-develop-x86_64-unknown-linux-gnu-portable.tar.gz ckb-develop-x86_64-unknown-linux-gnu-portable
echo "compare_result=true" >> $GITHUB_OUTPUT
fi
- name: Upload latest to Qiniu
if: ${{ steps.UpdateCkb.outputs.compare_result == 'true' }}
uses: gpBlockchain/upload-to-qiniu-action@main
with:
access_key: ${{ secrets.ACCESS_KEY }}
secret_key: ${{ secrets.SECRET_KEY }}
bucket_name: acceptance-test
key: ckb/bin/ckb-latest-x86_64-unknown-linux-gnu-portable.tar.gz
local_file: ckb-latest-x86_64-unknown-linux-gnu-portable.tar.gz
- name: Upload develop to Qiniu
if: ${{ steps.UpdateCkb.outputs.compare_result == 'true' }}
uses: gpBlockchain/upload-to-qiniu-action@main
with:
access_key: ${{ secrets.ACCESS_KEY }}
secret_key: ${{ secrets.SECRET_KEY }}
bucket_name: acceptance-test
key: ckb/bin/ckb-develop-x86_64-unknown-linux-gnu-portable.tar.gz
local_file: ckb-develop-x86_64-unknown-linux-gnu-portable.tar.gz