-
Notifications
You must be signed in to change notification settings - Fork 55
50 lines (46 loc) · 1.67 KB
/
publish.yml
File metadata and controls
50 lines (46 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Publish packages on NPM
on:
release:
types: [created]
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "24.x"
registry-url: "https://registry.npmjs.org"
- run: corepack enable && corepack prepare yarn@4.10.3 --activate
- run: yarn install --immutable
- run: yarn build
- run: npm publish
- name: Send success message to Slack
env:
SLACK_CHANNEL: "#serverless-releases"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
if: success()
run: |
set -x
OPS_MESSAGE=":gh-check-passed: serverless-plugin-datadog NPM publish succeeded!"
curl -H "Content-type: application/json" -X POST "$SLACK_WEBHOOK" -d '{
"channel": "'"$SLACK_CHANNEL"'",
"text": "'"$OPS_MESSAGE"'"
}'
- name: Send failure message to Slack
env:
SLACK_CHANNEL: "#serverless-onboarding-and-enablement-ops"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
if: failure()
run: |
set -x
OPS_MESSAGE=":gh-check-failed: serverless-plugin-datadog NPM publish failed!
Please check GitHub Action log: https://github.com/DataDog/serverless-plugin-datadog/actions/workflows/publish.yml"
curl -H "Content-type: application/json" -X POST "$SLACK_WEBHOOK" -d '{
"channel": "'"$SLACK_CHANNEL"'",
"text": "'"$OPS_MESSAGE"'"
}'