-
Notifications
You must be signed in to change notification settings - Fork 167
114 lines (104 loc) · 3.89 KB
/
build_packages.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
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
name: Build packages
on:
push:
pull_request:
release:
types:
- published
- prereleased
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os:
- ubuntu20.04
- ubuntu18.04
- ubuntu16.04
- debian10
- debian9
- centos8
- centos7
- centos6
steps:
- uses: actions/checkout@v1
- name: build emqx packages
env:
ERL_OTP: erl23.2.7.2-emqx-2
SYSTEM: ${{ matrix.os }}
run: |
docker run -i --name emqtt-$SYSTEM-build -v $(pwd):/emqtt emqx/build-env:$ERL_OTP-$SYSTEM /bin/bash -c "cd /emqtt && .github/workflows/script/build.sh"
cd _packages && for var in $(ls); do sudo bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"; done && cd -
- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'release' }}
with:
name: packages
path: _packages/*
build-on-mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: prepare
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install curl zip unzip gnu-sed erlang@24
echo "$(brew --prefix)/opt/erlang@24/bin" >> $GITHUB_PATH
echo "$(brew --prefix)/opt/unzip/bin" >> $GITHUB_PATH
echo "$(brew --prefix)/bin" >> $GITHUB_PATH
- name: install rebar3
run: |
curl -Lo /usr/local/bin/rebar3 https://github.com/erlang/rebar3/releases/download/3.19.0/rebar3
chmod +x /usr/local/bin/rebar3
- name: build
run: |
echo "${PATH}"
export PATH="/usr/local/opt/erlang@24/bin:$PATH"
erl -noshell -eval 'io:format(erlang:system_info(otp_release)), halt(0).'
.github/workflows/script/build.sh
pkg=emqtt-macos-$(git describe --tags --always).zip
openssl dgst -sha256 _packages/$pkg | awk '{print $2}' > _packages/$pkg.sha256
- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'release' }}
with:
name: packages-mac
path: _packages/*
release:
runs-on: ubuntu-latest
needs: [build, build-on-mac]
if: ${{ github.event_name == 'release' }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: packages
path: _packages
- uses: actions/download-artifact@v3
with:
name: packages-mac
path: _packages
- name: set aws
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.AwsAccessKeyId }}
aws-secret-access-key: ${{ secrets.AwsSecretAccessKey }}
aws-region: us-west-2
- name: get packages
run: |
cd _packages && for var in $( ls |grep emqtt |grep -v sha256); do
echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1
done
- name: verify packages
working-directory: _packages
run: |
for var in $(ls | grep emqtt | grep -v sha256); do
echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1
done
- name: upload aws
run: |
version=$(echo ${{ github.ref }} | sed -r "s .*/.*/(.*) \1 g")
aws s3 cp --recursive ./_packages s3://packages.emqx.io/emqtt/$version
aws cloudfront create-invalidation --distribution-id E3TYD0WSP4S14P --paths "/emqtt/$version/*"
- name: upload github
uses: softprops/action-gh-release@v1
with:
files: "_packages/*"