| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- name: Cross build packages
- concurrency:
- group: build-packages-${{ github.event_name }}-${{ github.ref }}
- cancel-in-progress: true
- on:
- workflow_call:
- inputs:
- profile:
- required: true
- type: string
- publish:
- required: true
- type: boolean
- otp_vsn:
- required: true
- type: string
- elixir_vsn:
- required: true
- type: string
- builder_vsn:
- required: true
- type: string
- secrets:
- AWS_ACCESS_KEY_ID:
- required: true
- AWS_SECRET_ACCESS_KEY:
- required: true
- AWS_DEFAULT_REGION:
- required: true
- AWS_S3_BUCKET:
- required: true
- AWS_CLOUDFRONT_ID:
- required: true
- APPLE_ID_PASSWORD:
- required: true
- APPLE_DEVELOPER_IDENTITY:
- required: true
- APPLE_DEVELOPER_ID_BUNDLE:
- required: true
- APPLE_DEVELOPER_ID_BUNDLE_PASSWORD:
- required: true
- workflow_dispatch:
- inputs:
- ref:
- required: false
- profile:
- required: true
- default: 'emqx'
- publish:
- required: false
- type: boolean
- default: false
- otp_vsn:
- required: false
- type: string
- default: '26.2.1-2'
- elixir_vsn:
- required: false
- type: string
- default: '1.15.7'
- builder_vsn:
- required: false
- type: string
- default: '5.3-5'
- permissions:
- contents: read
- jobs:
- mac:
- strategy:
- fail-fast: false
- matrix:
- profile:
- - ${{ inputs.profile }}
- os:
- - macos-13
- - macos-14
- otp:
- - ${{ inputs.otp_vsn }}
- runs-on: ${{ matrix.os }}
- steps:
- - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- with:
- ref: ${{ github.event.inputs.ref }}
- fetch-depth: 0
- - uses: ./.github/actions/package-macos
- with:
- profile: ${{ matrix.profile }}
- otp: ${{ matrix.otp }}
- os: ${{ matrix.os }}
- apple_id_password: ${{ secrets.APPLE_ID_PASSWORD }}
- apple_developer_identity: ${{ secrets.APPLE_DEVELOPER_IDENTITY }}
- apple_developer_id_bundle: ${{ secrets.APPLE_DEVELOPER_ID_BUNDLE }}
- apple_developer_id_bundle_password: ${{ secrets.APPLE_DEVELOPER_ID_BUNDLE_PASSWORD }}
- - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
- if: success()
- with:
- name: ${{ matrix.profile }}-${{ matrix.os }}-${{ matrix.otp }}
- path: _packages/${{ matrix.profile }}/
- retention-days: 7
- linux:
- runs-on: [self-hosted, ephemeral, linux, "${{ matrix.arch == 'arm64' && 'arm64' || 'x64' }}"]
- strategy:
- fail-fast: false
- matrix:
- profile:
- - ${{ inputs.profile }}
- os:
- - ubuntu24.04
- - ubuntu22.04
- - ubuntu20.04
- - ubuntu18.04
- - debian12
- - debian11
- - debian10
- - el9
- - el8
- - el7
- - amzn2
- - amzn2023
- arch:
- - amd64
- - arm64
- with_elixir:
- - 'no'
- otp:
- - ${{ inputs.otp_vsn }}
- builder:
- - ${{ inputs.builder_vsn }}
- elixir:
- - ${{ inputs.elixir_vsn }}
- include:
- - profile: ${{ inputs.profile }}
- os: ubuntu22.04
- arch: amd64
- with_elixir: 'yes'
- otp: ${{ inputs.otp_vsn }}
- builder: ${{ inputs.builder_vsn }}
- elixir: ${{ inputs.elixir_vsn }}
- defaults:
- run:
- shell: bash
- steps:
- - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- with:
- ref: ${{ github.event.inputs.ref }}
- fetch-depth: 0
- - name: build tgz
- env:
- PROFILE: ${{ matrix.profile }}
- ARCH: ${{ matrix.arch }}
- OS: ${{ matrix.os }}
- IS_ELIXIR: ${{ matrix.with_elixir }}
- BUILDER: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
- BUILDER_SYSTEM: force_docker
- run: |
- ./scripts/buildx.sh \
- --profile $PROFILE \
- --arch $ARCH \
- --builder $BUILDER \
- --elixir $IS_ELIXIR \
- --pkgtype tgz
- - name: build pkg
- if: matrix.with_elixir == 'no'
- env:
- PROFILE: ${{ matrix.profile }}
- ARCH: ${{ matrix.arch }}
- OS: ${{ matrix.os }}
- IS_ELIXIR: ${{ matrix.with_elixir }}
- BUILDER: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
- BUILDER_SYSTEM: force_docker
- run: |
- ./scripts/buildx.sh \
- --profile $PROFILE \
- --arch $ARCH \
- --builder $BUILDER \
- --elixir $IS_ELIXIR \
- --pkgtype pkg
- - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
- with:
- name: ${{ matrix.profile }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.with_elixir == 'yes' && '-elixir' || '' }}-${{ matrix.builder }}-${{ matrix.otp }}-${{ matrix.elixir }}
- path: _packages/${{ matrix.profile }}/
- retention-days: 7
- publish_artifacts:
- runs-on: ubuntu-latest
- needs:
- - mac
- - linux
- if: inputs.publish
- strategy:
- fail-fast: false
- matrix:
- profile:
- - ${{ inputs.profile }}
- steps:
- - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
- with:
- pattern: "${{ matrix.profile }}-*"
- path: packages/${{ matrix.profile }}
- merge-multiple: true
- - name: install dos2unix
- run: sudo apt-get update -y && sudo apt install -y dos2unix
- - name: get packages
- run: |
- set -eu
- cd packages/${{ matrix.profile }}
- # fix the .sha256 file format
- for f in *.sha256; do
- dos2unix $f
- echo "$(cat $f) ${f%.*}" | sha256sum -c || exit 1
- done
- cd -
- - uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
- 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: upload to aws s3
- env:
- PROFILE: ${{ matrix.profile }}
- REF_NAME: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.ref_name }}
- AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
- AWS_CLOUDFRONT_ID: ${{ secrets.AWS_CLOUDFRONT_ID }}
- run: |
- set -eu
- if [ $PROFILE = 'emqx' ]; then
- s3dir='emqx-ce'
- elif [ $PROFILE = 'emqx-enterprise' ]; then
- s3dir='emqx-ee'
- else
- echo "unknown profile $PROFILE"
- exit 1
- fi
- aws s3 cp --recursive packages/$PROFILE s3://$AWS_S3_BUCKET/$s3dir/$REF_NAME
- aws cloudfront create-invalidation --distribution-id "$AWS_CLOUDFRONT_ID" --paths "/$s3dir/$REF_NAME/*"
|