| 1 | --- |
| 2 | name: Monitor releases |
| 3 | |
| 4 | on: |
| 5 | release: |
| 6 | types: [released, deleted] |
| 7 | workflow_dispatch: |
| 8 | inputs: |
| 9 | channel: |
| 10 | description: 'Specify the release channel' |
| 11 | required: true |
| 12 | default: 'stable' |
| 13 | |
| 14 | |
| 15 | concurrency: |
| 16 | group: monitor-{{ github.event.inputs.channel }}-releases-${{ github.ref }}-${{ github.event_name }} |
| 17 | cancel-in-progress: true |
| 18 | |
| 19 | jobs: |
| 20 | update-agents-metadata: |
| 21 | name: update-agents-metadata |
| 22 | runs-on: ubuntu-latest |
| 23 | steps: |
| 24 | - name: Checkout |
| 25 | id: checkout |
| 26 | uses: actions/checkout@v6 |
| 27 | with: |
| 28 | token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }} |
| 29 | - name: Overwrite defaults |
| 30 | id: ow-defaults |
| 31 | run: | |
| 32 | if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then |
| 33 | echo "RELEASE_CHANNEL=${{ github.event.inputs.channel }}" >> "${GITHUB_ENV}" |
| 34 | else |
| 35 | echo "RELEASE_CHANNEL=stable" >> "${GITHUB_ENV}" |
| 36 | fi |
| 37 | - name: Init Python environment |
| 38 | uses: actions/setup-python@v6 |
| 39 | id: init-python |
| 40 | with: |
| 41 | python-version: "3.12" |
| 42 | - name: Setup python environment |
| 43 | id: setup-python |
| 44 | run: | |
| 45 | pip install -r .github/scripts/modules/requirements.txt |
| 46 | - name: Check for newer versions |
| 47 | id: check-newer-releases |
| 48 | run: | |
| 49 | python .github/scripts/check_latest_versions_per_channel.py "${{ env.RELEASE_CHANNEL }}" |
| 50 | - name: SSH setup |
| 51 | id: ssh-setup |
| 52 | if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' && steps.check-newer-releases.outputs.versions_needs_update == 'true' |
| 53 | uses: shimataro/ssh-key-action@v2 |
| 54 | with: |
| 55 | key: ${{ secrets.NETDATABOT_PACKAGES_SSH_KEY }} |
| 56 | name: id_ecdsa |
| 57 | known_hosts: ${{ secrets.PACKAGES_KNOWN_HOSTS }} |
| 58 | - name: Sync newer releases to packages.netdata.cloud |
| 59 | id: sync-releases |
| 60 | continue-on-error: true |
| 61 | if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' && steps.check-newer-releases.outputs.versions_needs_update == 'true' |
| 62 | run: | |
| 63 | .github/scripts/upload-new-version-tags.sh packages.netdata.cloud |
| 64 | - name: Sync newer releases to packages2.netdata.cloud |
| 65 | id: sync-releases2 |
| 66 | if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' && steps.check-newer-releases.outputs.versions_needs_update == 'true' |
| 67 | run: | |
| 68 | .github/scripts/upload-new-version-tags.sh packages2.netdata.cloud |
| 69 | - name: Failure Notification |
| 70 | uses: rtCamp/action-slack-notify@v2 |
| 71 | env: |
| 72 | SLACK_COLOR: 'danger' |
| 73 | SLACK_FOOTER: '' |
| 74 | SLACK_ICON_EMOJI: ':github-actions:' |
| 75 | SLACK_TITLE: 'Failed to prepare changelog:' |
| 76 | SLACK_USERNAME: 'GitHub Actions' |
| 77 | SLACK_MESSAGE: |- |
| 78 | ${{ github.repository }}: Failed to update stable Agent's metadata. |
| 79 | Checkout: ${{ steps.checkout.outcome }} |
| 80 | Overwrite inputs: ${{ steps.ow-defaults.outcome }} |
| 81 | Init python: ${{ steps.init-python.outcome }} |
| 82 | Setup python: ${{ steps.setup-python.outcome }} |
| 83 | Check for newer stable releaes: ${{ steps.check-newer-releases.outcome }} |
| 84 | Setup ssh: ${{ steps.ssh-setup.outcome }} |
| 85 | Syncing newer release to packages.netdata.cloud : ${{ steps.sync-releases.outcome }} |
| 86 | Syncing newer release to packages2.netdata.cloud : ${{ steps.sync-releases2.outcome }} |
| 87 | SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 88 | if: failure() |