104 lines
4.2 KiB
YAML
104 lines
4.2 KiB
YAML
name: Upload release assets
|
|
on:
|
|
release:
|
|
types:
|
|
- published
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
type: string
|
|
required: true
|
|
publish_release_artefacts:
|
|
type: boolean
|
|
required: true
|
|
default: false
|
|
|
|
jobs:
|
|
upload:
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
fail-fast: false
|
|
steps:
|
|
- uses: aws-actions/configure-aws-credentials@v2
|
|
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 }}
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.inputs.tag }}
|
|
- name: Detect profile
|
|
id: profile
|
|
run: |
|
|
if git describe --tags --match '[v|e]*' --exact; then
|
|
REF=$(git describe --tags --match '[v|e]*' --exact)
|
|
else
|
|
echo "Only release tags matching '[v|e]*' are supported"
|
|
exit 1
|
|
fi
|
|
case "$REF" in
|
|
v*)
|
|
echo "profile=emqx" >> $GITHUB_OUTPUT
|
|
echo "version=$(./pkg-vsn.sh emqx)" >> $GITHUB_OUTPUT
|
|
echo "s3dir=emqx-ce" >> $GITHUB_OUTPUT
|
|
;;
|
|
e*)
|
|
echo "profile=emqx-enterprise" >> $GITHUB_OUTPUT
|
|
echo "version=$(./pkg-vsn.sh emqx-enterprise)" >> $GITHUB_OUTPUT
|
|
echo "s3dir=emqx-ee" >> $GITHUB_OUTPUT
|
|
;;
|
|
esac
|
|
- name: Get packages
|
|
run: |
|
|
BUCKET=${{ secrets.AWS_S3_BUCKET }}
|
|
OUTPUT_DIR=${{ steps.profile.outputs.s3dir }}
|
|
aws s3 cp --recursive s3://$BUCKET/$OUTPUT_DIR/${{ github.ref_name }} packages
|
|
- uses: alexellis/upload-assets@0.4.0
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
with:
|
|
asset_paths: '["packages/*"]'
|
|
- name: update to emqx.io
|
|
if: startsWith(github.ref_name, 'v') && (github.event_name == 'release' || inputs.publish_release_artefacts)
|
|
run: |
|
|
set -eux
|
|
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: Push to packagecloud.io
|
|
env:
|
|
PROFILE: ${{ steps.profile.outputs.profile }}
|
|
VERSION: ${{ steps.profile.outputs.version }}
|
|
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
|
|
run: |
|
|
set -eu
|
|
REPO=$PROFILE
|
|
if [ $PROFILE = 'emqx-enterprise' ]; then
|
|
REPO='emqx-enterprise5'
|
|
fi
|
|
function push() {
|
|
docker run -t --rm -e PACKAGECLOUD_TOKEN=$PACKAGECLOUD_TOKEN -v $(pwd)/$2:/w/$2 -w /w ghcr.io/emqx/package_cloud push emqx/$REPO/$1 $2
|
|
}
|
|
push "debian/buster" "packages/$PROFILE-$VERSION-debian10-amd64.deb"
|
|
push "debian/buster" "packages/$PROFILE-$VERSION-debian10-arm64.deb"
|
|
push "debian/bullseye" "packages/$PROFILE-$VERSION-debian11-amd64.deb"
|
|
push "debian/bullseye" "packages/$PROFILE-$VERSION-debian11-arm64.deb"
|
|
push "ubuntu/bionic" "packages/$PROFILE-$VERSION-ubuntu18.04-amd64.deb"
|
|
push "ubuntu/bionic" "packages/$PROFILE-$VERSION-ubuntu18.04-arm64.deb"
|
|
push "ubuntu/focal" "packages/$PROFILE-$VERSION-ubuntu20.04-amd64.deb"
|
|
push "ubuntu/focal" "packages/$PROFILE-$VERSION-ubuntu20.04-arm64.deb"
|
|
push "ubuntu/jammy" "packages/$PROFILE-$VERSION-ubuntu22.04-amd64.deb"
|
|
push "ubuntu/jammy" "packages/$PROFILE-$VERSION-ubuntu22.04-arm64.deb"
|
|
push "el/6" "packages/$PROFILE-$VERSION-amzn2-amd64.rpm"
|
|
push "el/6" "packages/$PROFILE-$VERSION-amzn2-arm64.rpm"
|
|
push "el/7" "packages/$PROFILE-$VERSION-el7-amd64.rpm"
|
|
push "el/7" "packages/$PROFILE-$VERSION-el7-arm64.rpm"
|
|
push "el/8" "packages/$PROFILE-$VERSION-el8-amd64.rpm"
|
|
push "el/8" "packages/$PROFILE-$VERSION-el8-arm64.rpm"
|
|
push "el/9" "packages/$PROFILE-$VERSION-el9-amd64.rpm"
|
|
push "el/9" "packages/$PROFILE-$VERSION-el9-arm64.rpm"
|