merge branch tag-1.2.3.3 #916
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/*" |