From 18085805d90c9fcb31720d318e8a3fb4ffb69070 Mon Sep 17 00:00:00 2001 From: Levi <141682181+levisingularity@users.noreply.github.com> Date: Mon, 19 Aug 2024 08:41:40 -0300 Subject: [PATCH] ci: notify mattermost when publish hypern-das-commons (#86) --- .../workflows/publish-hyperon-das-commons.yml | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish-hyperon-das-commons.yml b/.github/workflows/publish-hyperon-das-commons.yml index 4d6eefe..95840b1 100644 --- a/.github/workflows/publish-hyperon-das-commons.yml +++ b/.github/workflows/publish-hyperon-das-commons.yml @@ -9,20 +9,35 @@ on: required: true jobs: - tag: + notify-mattermost: if: github.ref == 'refs/heads/master' - uses: singnet/das/.github/workflows/run-semver.yml@master - with: - version: ${{ github.event.inputs.version }} - version-strategy: bump-version-from-variable-value - job-image-namespace: trueagi - job-image-version-semver: semantic-versioning - main-branch: master - version-tag-regex-pattern: /^\d+\.\d+\.\d+$/ - version-require-confirmation: "true" - title: New version of hyperon-das-commons - deliverable: Library in PyPI named hyperon-das-commons - secrets: inherit + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Create mattermost message + run: | + title="New version of hyperon-das-commons" + deliverable="Library in PyPI named hyperon-das-commons" + version="${{ github.event.inputs.version }}" + repository="${{ github.GITHUB_REPOSITORY }}" + releaseNote="" + + message="${title}\n\nDeliverable:${deliverable}\nNew version available: $version\nRepository: https://github.com/$repository/releases/tag/$version" + + if [ -n "$releaseNote" ]; then + message="$message\nChanges:\n$releaseNote" + fi + + escaped_message=$(printf '%s' "$message" | jq -sRr @json | sed 's/\\\\n/\\n/g') + + echo "{\"text\": $escaped_message}" > mattermost.json + + - name: Notify Mattermost + uses: singnet/integration-github-mattermost@master + with: + webhook-url: ${{ secrets.MATTERMOST_WEBHOOK_URL }} publish: runs-on: ubuntu-latest