diff --git a/.github/workflows/build_packages.yaml b/.github/workflows/build_packages.yaml index 6f13ae345..69e0eaa93 100644 --- a/.github/workflows/build_packages.yaml +++ b/.github/workflows/build_packages.yaml @@ -398,121 +398,123 @@ jobs: # file: source/deploy/docker/Dockerfile # context: source # -# delete-artifact: -# -# runs-on: ubuntu-20.04 -# strategy: -# matrix: -# otp: -# - 23.2.7.2-emqx-2 -# - 24.1.1-emqx-1 + delete-artifact: + + runs-on: ubuntu-20.04 + strategy: + matrix: + otp: + - 23.2.7.2-emqx-2 + - 24.1.1-emqx-1 # needs: [prepare, mac, linux, docker] -# steps: -# - uses: geekyeggo/delete-artifact@v1 -# with: -# name: source-${{ matrix.otp }} -# -# upload: -# runs-on: ubuntu-20.04 -# -# if: startsWith(github.ref, 'refs/tags/') -# + needs: [mac] + steps: + - uses: geekyeggo/delete-artifact@v1 + with: + name: source-${{ matrix.otp }} + + upload: + runs-on: ubuntu-20.04 + + if: startsWith(github.ref, 'refs/tags/') + # needs: [prepare, mac, linux, docker] -# -# strategy: -# matrix: -# profile: ${{fromJSON(needs.prepare.outputs.profiles)}} -# otp: -# - 24.1.1-emqx-1 -# -# steps: -# - uses: actions/checkout@v2 -# - name: get_version -# run: | -# echo 'version<> $GITHUB_ENV -# echo ${{ github.ref }} | sed -r "s ^refs/heads/|^refs/tags/(.*) \1 g" >> $GITHUB_ENV -# echo 'EOF' >> $GITHUB_ENV -# - uses: actions/download-artifact@v2 -# with: -# name: ${{ matrix.profile }}-${{ matrix.otp }} -# path: ./_packages/${{ matrix.profile }} -# - name: install dos2unix -# run: sudo apt-get update && sudo apt install -y dos2unix -# - name: get packages -# run: | -# set -e -u -# cd _packages/${{ matrix.profile }} -# for var in $( ls |grep emqx |grep -v sha256); do -# dos2unix $var.sha256 -# echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1 -# done -# cd - -# - name: upload aws s3 -# run: | -# set -e -u -# if [ "${{ matrix.profile }}" == "emqx" ];then -# broker="emqx-ce" -# else -# broker=${{ matrix.profile }} -# fi -# aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} -# aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} -# aws configure set default.region ${{ secrets.AWS_DEFAULT_REGION }} -# -# aws s3 cp --recursive _packages/${{ matrix.profile }} s3://${{ secrets.AWS_S3_BUCKET }}/$broker/${{ env.version }} -# aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID }} --paths "/$broker/${{ env.version }}/*" -# - uses: Rory-Z/upload-release-asset@v1 -# if: github.event_name == 'release' && matrix.profile != 'emqx-ee' -# with: -# repo: emqx -# path: "_packages/${{ matrix.profile }}/emqx-*" -# token: ${{ github.token }} -# - uses: Rory-Z/upload-release-asset@v1 -# if: github.event_name == 'release' && matrix.profile == 'emqx-ee' -# with: -# repo: emqx-enterprise -# path: "_packages/${{ matrix.profile }}/emqx-*" -# token: ${{ github.token }} -# - name: update to emqx.io -# if: github.event_name == 'release' -# run: | -# set -e -x -u -# curl -w %{http_code} \ -# --insecure \ -# -H "Content-Type: application/json" \ -# -H "token: ${{ secrets.EMQX_IO_TOKEN }}" \ -# -X POST \ -# -d "{\"repo\":\"emqx/emqx\", \"tag\": \"${{ env.version }}\" }" \ -# ${{ secrets.EMQX_IO_RELEASE_API }} -# - name: update repo.emqx.io -# if: github.event_name == 'release' && endsWith(github.repository, 'enterprise') && matrix.profile == 'emqx-ee' -# run: | -# curl --silent --show-error \ -# -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \ -# -H "Accept: application/vnd.github.v3+json" \ -# -X POST \ -# -d "{\"ref\":\"v1.0.3\",\"inputs\":{\"version\": \"${{ env.version }}\", \"emqx_ee\": \"true\"}}" \ -# "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches" -# - name: update repo.emqx.io -# if: github.event_name == 'release' && endsWith(github.repository, 'emqx') && matrix.profile == 'emqx' -# run: | -# curl --silent --show-error \ -# -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \ -# -H "Accept: application/vnd.github.v3+json" \ -# -X POST \ -# -d "{\"ref\":\"v1.0.3\",\"inputs\":{\"version\": \"${{ env.version }}\", \"emqx_ce\": \"true\"}}" \ -# "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches" -# - name: update homebrew packages -# if: github.event_name == 'release' && endsWith(github.repository, 'emqx') && matrix.profile == 'emqx' -# run: | -# if [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then -# curl --silent --show-error \ -# -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \ -# -H "Accept: application/vnd.github.v3+json" \ -# -X POST \ -# -d "{\"ref\":\"v1.0.3\",\"inputs\":{\"version\": \"${{ env.version }}\"}}" \ -# "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_homebrew.yaml/dispatches" -# fi -# - uses: geekyeggo/delete-artifact@v1 -# with: -# name: ${{ matrix.profile }} + needs: [mac] + + strategy: + matrix: + profile: ${{fromJSON(needs.prepare.outputs.profiles)}} + otp: + - 24.1.1-emqx-1 + + steps: + - uses: actions/checkout@v2 + - name: get_version + run: | + echo 'version<> $GITHUB_ENV + echo ${{ github.ref }} | sed -r "s ^refs/heads/|^refs/tags/(.*) \1 g" >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + - uses: actions/download-artifact@v2 + with: + name: ${{ matrix.profile }}-${{ matrix.otp }} + path: ./_packages/${{ matrix.profile }} + - name: install dos2unix + run: sudo apt-get update && sudo apt install -y dos2unix + - name: get packages + run: | + set -e -u + cd _packages/${{ matrix.profile }} + for var in $( ls |grep emqx |grep -v sha256); do + dos2unix $var.sha256 + echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1 + done + cd - + - name: upload aws s3 + run: | + set -e -u + if [ "${{ matrix.profile }}" == "emqx" ];then + broker="emqx-ce" + else + broker=${{ matrix.profile }} + fi + aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} + aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws configure set default.region ${{ secrets.AWS_DEFAULT_REGION }} + + aws s3 cp --recursive _packages/${{ matrix.profile }} s3://${{ secrets.AWS_S3_BUCKET }}/$broker/${{ env.version }} + aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID }} --paths "/$broker/${{ env.version }}/*" + - uses: Rory-Z/upload-release-asset@v1 + if: github.event_name == 'release' && matrix.profile != 'emqx-ee' + with: + repo: emqx + path: "_packages/${{ matrix.profile }}/emqx-*" + token: ${{ github.token }} + - uses: Rory-Z/upload-release-asset@v1 + if: github.event_name == 'release' && matrix.profile == 'emqx-ee' + with: + repo: emqx-enterprise + path: "_packages/${{ matrix.profile }}/emqx-*" + token: ${{ github.token }} + - name: update to emqx.io + if: github.event_name == 'release' + run: | + set -e -x -u + curl -w %{http_code} \ + --insecure \ + -H "Content-Type: application/json" \ + -H "token: ${{ secrets.EMQX_IO_TOKEN }}" \ + -X POST \ + -d "{\"repo\":\"emqx/emqx\", \"tag\": \"${{ env.version }}\" }" \ + ${{ secrets.EMQX_IO_RELEASE_API }} + - name: update repo.emqx.io + if: github.event_name == 'release' && endsWith(github.repository, 'enterprise') && matrix.profile == 'emqx-ee' + run: | + curl --silent --show-error \ + -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + -X POST \ + -d "{\"ref\":\"v1.0.3\",\"inputs\":{\"version\": \"${{ env.version }}\", \"emqx_ee\": \"true\"}}" \ + "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches" + - name: update repo.emqx.io + if: github.event_name == 'release' && endsWith(github.repository, 'emqx') && matrix.profile == 'emqx' + run: | + curl --silent --show-error \ + -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + -X POST \ + -d "{\"ref\":\"v1.0.3\",\"inputs\":{\"version\": \"${{ env.version }}\", \"emqx_ce\": \"true\"}}" \ + "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches" + - name: update homebrew packages + if: github.event_name == 'release' && endsWith(github.repository, 'emqx') && matrix.profile == 'emqx' + run: | + if [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then + curl --silent --show-error \ + -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + -X POST \ + -d "{\"ref\":\"v1.0.3\",\"inputs\":{\"version\": \"${{ env.version }}\"}}" \ + "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_homebrew.yaml/dispatches" + fi + - uses: geekyeggo/delete-artifact@v1 + with: + name: ${{ matrix.profile }}