Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add announce #79

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/announce.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
release:
types:
- published
jobs:
slack:
runs-on: ubuntu-latest
steps:
- name: Get tag
id: get_tag
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Get version
id: get_version
run: echo "VERSION=${TAG##v}" >> $GITHUB_OUTPUT
env:
TAG: ${{ steps.get_tag.outputs.TAG }}
- name: Prepare message
id: get_message
run: echo "MSG=${{ secrets.SLACK_MESSAGE }}" >> $GITHUB_OUTPUT
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
TAG: ${{ steps.get_tag.outputs.TAG }}
RELEASE_URL: "https://github.com/scaleway/packer-plugin-scaleway/releases/tag/${{ steps.get_tag.outputs.TAG }}"
- name: Announce on slack
id: announce_slack
run: |
readarray -td' ' URL_LIST <<<$SLACK_WEBHOOKS;
for WEBHOOK_URL in ${URL_LIST[@]};
do curl -X POST -H 'Content-type: application/json' \
--data '{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "'"${MESSAGE}"'"
}
}
]
}' \
${WEBHOOK_URL};
done
env:
SLACK_WEBHOOKS: ${{ secrets.SLACK_WEBHOOKS }}
MESSAGE: ${{ steps.get_message.outputs.MSG }}