-
Notifications
You must be signed in to change notification settings - Fork 60
100 lines (88 loc) · 3.06 KB
/
prerelease.yml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Publish Raygun4JS to the pre-release environment
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 20.x ]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Grunt
run: npm install -g grunt
- name: Install node modules
run: npm install
- name: Build
id: build_step
run: grunt build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }}
aws-secret-access-key: ${{ secrets.AWS_ACCESS_SECRET }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Publish to S3 Pre-release
id: publish_s3
run: aws s3 sync ./dist ${{ secrets.AWS_PUBLISH_TARGET }}
- name: Create CloudFront Cache Invalidation
id: cache_invalidation
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "${{ secrets.AWS_CLOUDFRONT_INVALIDATION_PATH }}"
- name: Notify Slack
id: slack
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "A new pre-release version of Raygun4JS has been published"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View this action run in GitHub>"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Branch:*\n`${{ github.ref_name }}`"
},
{
"type": "mrkdwn",
"text": "*Node version:*\n`${{ matrix.node-version }}`"
},
{
"type": "mrkdwn",
"text": "*Build status:*\n_${{ steps.build_step.outcome }}_"
},
{
"type": "mrkdwn",
"text": "*S3 publish status:*\n_${{ steps.publish_s3.outcome }}_"
},
{
"type": "mrkdwn",
"text": "*CloudFront cache invalidation status:*\n_${{ steps.cache_invalidation.outcome }}_"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK