Skip to content

Commit

Permalink
shelll
Browse files Browse the repository at this point in the history
  • Loading branch information
h7ml committed May 31, 2021
1 parent e17e302 commit b9e672c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 11 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build_packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
if make -C source emqx-ee --dry-run > /dev/null 2>&1; then
echo "::set-output name=profiles::[\"emqx-ee\"]"
else
echo "::set-output name=profiles::[\"emqx\", \"emqx-edge\"]"
echo "::set-output name=profiles::[\"dgiot\", \"emqx-edge\"]"
fi
- name: get_all_deps
if: endsWith(github.repository, 'emqx')
if: endsWith(github.repository, 'dgiot')
run: |
make -C source deps-all
zip -ryq source.zip source
Expand All @@ -55,7 +55,7 @@ jobs:
runs-on: windows-2019

needs: prepare
if: endsWith(github.repository, 'emqx')
if: endsWith(github.repository, 'dgiot')

strategy:
matrix:
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
Compress-Archive -Path _build/${{ matrix.profile }}/rel/emqx -DestinationPath _build/${{ matrix.profile }}/rel/$pkg_name
mv _build/${{ matrix.profile }}/rel/$pkg_name _packages/${{ matrix.profile }}
Get-FileHash -Path "_packages/${{ matrix.profile }}/$pkg_name" | Format-List | grep 'Hash' | awk '{print $3}' > _packages/${{ matrix.profile }}/$pkg_name.sha256
- name: run emqx
- name: run dgiot
timeout-minutes: 1
run: |
cd source
Expand Down Expand Up @@ -253,7 +253,7 @@ jobs:
run: |
set -e -u -x
cd source
if [ $PROFILE = "emqx" ];then broker="emqx-ce"; else broker="$PROFILE"; fi
if [ $PROFILE = "dgiot" ];then broker="emqx-ce"; else broker="$PROFILE"; fi
if [ $PROFILE = "emqx-ee" ];then edition='enterprise'; else edition='opensource'; fi
vsn="$(./pkg-vsn.sh)"
Expand Down Expand Up @@ -403,7 +403,7 @@ jobs:
- name: upload aws s3
run: |
set -e -u
if [ "${{ matrix.profile }}" == "emqx" ];then
if [ "${{ matrix.profile }}" == "dgiot" ];then
broker="emqx-ce"
else
broker=${{ matrix.profile }}
Expand All @@ -417,14 +417,14 @@ jobs:
- uses: Rory-Z/upload-release-asset@v1
if: github.event_name == 'release' && matrix.profile != 'emqx-ee'
with:
repo: emqx
path: "_packages/${{ matrix.profile }}/emqx-*"
repo: dgiot
path: "_packages/${{ matrix.profile }}/dgiot-*"
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-*"
path: "_packages/${{ matrix.profile }}/dgiot-*"
token: ${{ github.token }}
- name: update to emqx.io
if: github.event_name == 'release'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_slim_packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
echo "${{ secrets.CI_GIT_TOKEN }}" >> ./scripts/git-token
echo "EMQX_NAME=emqx-ee" >> $GITHUB_ENV
else
echo "EMQX_NAME=emqx" >> $GITHUB_ENV
echo "EMQX_NAME=dgiot" >> $GITHUB_ENV
fi
- name: build zip packages
run: make ${EMQX_NAME}-zip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/git_sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
sync_to_enterprise:
runs-on: ubuntu-20.04
if: github.repository == 'emqx/emqx'
if: github.repository == 'dgiot/dgiot'
steps:
- name: git-sync
uses: Rory-Z/[email protected]
Expand Down
34 changes: 34 additions & 0 deletions scripts/apps-version-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -euo pipefail

remote="refs/remote/$(git remote -v | grep fetch | grep 'dgiot/dgiot' | awk '{print $1}')"
latest_release=$(git describe --tags "$(git rev-list --tags --max-count=1 --remotes="$remote")")

bad_app_count=0

while read -r app; do
if [ "$app" != "dgiot" ]; then
app_path="$app"
else
app_path="."
fi
src_file="$app_path/src/$(basename "$app").app.src"
old_app_version="$(git show "$latest_release":"$src_file" | grep vsn | grep -oE '"[0-9]+.[0-9]+.[0-9]+"' | tr -d '"')"
now_app_version=$(grep -E 'vsn' "$src_file" | grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"')
if [ "$old_app_version" = "$now_app_version" ]; then
changed="$(git diff --name-only "$latest_release"...HEAD \
-- "$app_path/src" \
-- "$app_path/priv" \
-- "$app_path/c_src" | wc -l)"
if [ "$changed" -gt 0 ]; then
echo "$src_file needs a vsn bump"
bad_app_count=$(( bad_app_count + 1))
fi
fi
done < <(./scripts/find-apps.sh)

if [ $bad_app_count -gt 0 ]; then
exit 1
else
echo "apps version check successfully"
fi

0 comments on commit b9e672c

Please sign in to comment.