109 lines
4.0 KiB
YAML
109 lines
4.0 KiB
YAML
name: Upload release assets
|
|
on:
|
|
release:
|
|
types:
|
|
- published
|
|
|
|
jobs:
|
|
upload:
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
fail-fast: false
|
|
steps:
|
|
- uses: aws-actions/configure-aws-credentials@v1-node16
|
|
with:
|
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
|
|
- name: Get packages
|
|
run: |
|
|
REF=${{ github.ref_name }}
|
|
case "$REF" in
|
|
v*)
|
|
s3dir='emqx-ce'
|
|
;;
|
|
e*)
|
|
s3dir='emqx-ee'
|
|
;;
|
|
*)
|
|
echo "tag $REF is not supported"
|
|
exit 1
|
|
;;
|
|
esac
|
|
aws s3 cp --recursive s3://${{ secrets.AWS_S3_BUCKET }}/$s3dir/${{ github.ref_name }} packages
|
|
cd packages
|
|
DEFAULT_BEAM_PLATFORM='otp24.3.4.2-1'
|
|
# all packages including full-name and default-name are uploaded to s3
|
|
# but we only upload default-name packages (and elixir) as github artifacts
|
|
# so we rename (overwrite) non-default packages before uploading
|
|
while read -r fname; do
|
|
default_fname=$(echo "$fname" | sed "s/-${DEFAULT_BEAM_PLATFORM}//g")
|
|
echo "$fname -> $default_fname"
|
|
mv -f "$fname" "$default_fname"
|
|
done < <(find . -maxdepth 1 -type f | grep -E "emqx(-enterprise)?-5\.[0-9]+\.[0-9]+.*-${DEFAULT_BEAM_PLATFORM}" | grep -v elixir)
|
|
- uses: alexellis/upload-assets@0.4.0
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
with:
|
|
asset_paths: '["packages/*"]'
|
|
- 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\": \"${{ github.ref_name }}\" }" \
|
|
${{ secrets.EMQX_IO_RELEASE_API }}
|
|
- name: update homebrew packages
|
|
if: github.event_name == 'release'
|
|
run: |
|
|
REF=${{ github.ref_name }}
|
|
case "$REF" in
|
|
v*)
|
|
BOOL_FLAG_NAME="emqx_ce"
|
|
;;
|
|
e*)
|
|
echo "Not updating homebrew for enterprise eidition"
|
|
exit 0
|
|
;;
|
|
esac
|
|
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.4\",\"inputs\":{\"version\": \"${{ github.ref_name }}\"}}" \
|
|
"https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_homebrew.yaml/dispatches"
|
|
fi
|
|
|
|
upload-helm:
|
|
runs-on: ubuntu-20.04
|
|
if: github.event_name == 'release'
|
|
strategy:
|
|
fail-fast: false
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.ref }}
|
|
- uses: emqx/push-helm-action@v1
|
|
if: startsWith(github.ref_name, 'v')
|
|
with:
|
|
charts_dir: "${{ github.workspace }}/deploy/charts/emqx"
|
|
version: ${{ github.ref_name }}
|
|
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
aws_region: "us-west-2"
|
|
aws_bucket_name: "repos-emqx-io"
|
|
- uses: emqx/push-helm-action@v1
|
|
if: startsWith(github.ref_name, 'e')
|
|
with:
|
|
charts_dir: "${{ github.workspace }}/deploy/charts/emqx-enterprise"
|
|
version: ${{ github.ref_name }}
|
|
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
aws_region: "us-west-2"
|
|
aws_bucket_name: "repos-emqx-io"
|