ci: automatically push packages to packagecloud.io

This commit is contained in:
Ivan Dyachkov 2023-01-24 13:48:46 +01:00
parent ec21e36207
commit 16042373c7
1 changed files with 32 additions and 10 deletions

View File

@ -27,6 +27,7 @@ jobs:
outputs: outputs:
BUILD_PROFILE: ${{ steps.get_profile.outputs.BUILD_PROFILE }} BUILD_PROFILE: ${{ steps.get_profile.outputs.BUILD_PROFILE }}
IS_EXACT_TAG: ${{ steps.get_profile.outputs.IS_EXACT_TAG }} IS_EXACT_TAG: ${{ steps.get_profile.outputs.IS_EXACT_TAG }}
VERSION: ${{ steps.get_profile.outputs.VERSION }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -75,6 +76,7 @@ jobs:
;; ;;
esac esac
echo "BUILD_PROFILE=$PROFILE" >> $GITHUB_OUTPUT echo "BUILD_PROFILE=$PROFILE" >> $GITHUB_OUTPUT
echo "VERSION=$(./pkg-vsn.sh $PROFILE)" >> $GITHUB_OUTPUT
- name: get_all_deps - name: get_all_deps
run: | run: |
make -C source deps-all make -C source deps-all
@ -204,13 +206,13 @@ jobs:
- amd64 - amd64
- arm64 - arm64
os: os:
- ubuntu20.04 - ["ubuntu20.04", "ubuntu/focal", "deb"]
- ubuntu18.04 - ["ubuntu18.04", "ubuntu/bionic", "deb"]
- debian11 - ["debian11", "debian/bullseye", "deb"]
- debian10 - ["debian10", "debian/buster", "deb"]
- el8 - ["el8", "el/8", "rpm"]
- el7 - ["el7", "el/7", "rpm"]
- amzn2 - ["amzn2", "el/6", "rpm"]
build_machine: build_machine:
- aws-arm64 - aws-arm64
- ubuntu-20.04 - ubuntu-20.04
@ -227,7 +229,7 @@ jobs:
- profile: emqx - profile: emqx
otp: 25.1.2-2 otp: 25.1.2-2
arch: amd64 arch: amd64
os: ubuntu20.04 os: ["ubuntu20.04", "ubuntu/focal", "deb"]
build_machine: ubuntu-20.04 build_machine: ubuntu-20.04
builder: 5.0-26 builder: 5.0-26
elixir: 1.13.4 elixir: 1.13.4
@ -235,7 +237,7 @@ jobs:
- profile: emqx - profile: emqx
otp: 25.1.2-2 otp: 25.1.2-2
arch: amd64 arch: amd64
os: amzn2 os: ["amzn2", "el/6", "rpm"]
build_machine: ubuntu-20.04 build_machine: ubuntu-20.04
builder: 5.0-26 builder: 5.0-26
elixir: 1.13.4 elixir: 1.13.4
@ -262,7 +264,7 @@ jobs:
OTP: ${{ matrix.otp }} OTP: ${{ matrix.otp }}
PROFILE: ${{ matrix.profile }} PROFILE: ${{ matrix.profile }}
ARCH: ${{ matrix.arch }} ARCH: ${{ matrix.arch }}
SYSTEM: ${{ matrix.os }} SYSTEM: ${{ matrix.os[0] }}
run: | run: |
set -eu set -eu
git config --global --add safe.directory "/__w/emqx/emqx" git config --global --add safe.directory "/__w/emqx/emqx"
@ -288,11 +290,31 @@ jobs:
--elixir "${IS_ELIXIR}" \ --elixir "${IS_ELIXIR}" \
--builder "ghcr.io/emqx/emqx-builder/${BUILDER}:${ELIXIR}-${OTP}-${SYSTEM}" --builder "ghcr.io/emqx/emqx-builder/${BUILDER}:${ELIXIR}-${OTP}-${SYSTEM}"
done done
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
if: success() if: success()
with: with:
name: ${{ matrix.profile }} name: ${{ matrix.profile }}
path: source/_packages/${{ matrix.profile }}/ path: source/_packages/${{ matrix.profile }}/
- name: Push to packagecloud.io
if: success() && ${{ needs.prepare.outputs.IS_EXACT_TAG }}
working-directory: source
env:
PROFILE: ${{ matrix.profile }}
ARCH: ${{ matrix.arch }}
OS: ${{ matrix.os[0] }}
OS_CODENAME: ${{ matrix.os[1] }}
PKG_EXT: ${{ matrix.os[2] }}
VERSION: ${{ needs.prepare.outputs.VERSION }}
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
run: |
set -eu
REPO=$PROFILE
if [ $PROFILE = 'emqx-enterprise' ]; then
REPO='emqx-enterprise5'
docker run -t --rm -e PACKAGECLOUD_TOKEN=$PACKAGECLOUD_TOKEN \
ghcr.io/emqx/package_cloud push emqx/$REPO/$OS_CODENAME \
_packages/$PROFILE/$PROFILE-$VERSION-$OS-$ARCH.$PKG_EXT
- name: Send notification to Slack - name: Send notification to Slack
uses: slackapi/slack-github-action@v1.23.0 uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.event_name == 'schedule' if: failure() && github.event_name == 'schedule'