-
Notifications
You must be signed in to change notification settings - Fork 5
137 lines (118 loc) · 3.94 KB
/
Copy pathrun.yml
File metadata and controls
137 lines (118 loc) · 3.94 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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Build specification
on:
push:
paths-ignore:
- 'collection/resource/**'
- 'collection/log/**'
- 'index/**'
- 'var/**'
branches:
main
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
environment:
type: environment
description: The environment to deploy to.
env:
DLB_BOT_EMAIL: ${{ secrets.DLB_BOT_EMAIL }}
DLB_BOT_TOKEN: ${{ secrets.DLB_BOT_TOKEN }}
DLB_BOT_USERNAME: ${{ secrets.DLB_BOT_USERNAME }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}
- name: Setup git
run: |
git config user.email "${DLB_BOT_EMAIL}"
git config user.name "${DLB_BOT_USERNAME}"
git remote set-url origin https://${DLB_BOT_USERNAME}:${DLB_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git checkout ${GITHUB_REF##*/}
- name: Update makerules
run: make makerules
- name: Commit updated makerules
run: make commit-makerules
- name: Clean specification and docs
run: make clean clobber
- name: Install dependencies
run: make init
- name: Build specification
run: make specification
- name: Check specification
run: make check
- name: Commit specification
run: make commit-specification
- name: Build docs
run: make render
- name: Commit docs
run: make commit-docs
detect-environments:
runs-on: ubuntu-latest
outputs:
environments: ${{ steps.environments.outputs.result }}
steps:
- uses: actions/github-script@v6
id: environments
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: json
script: |
if (context.payload?.inputs?.environment) return [context.payload?.inputs?.environment];
const {data: {environments}} =
await github.request(`GET /repos/${process.env.GITHUB_REPOSITORY}/environments`);
return environments.map(e => e.name).filter(name => name !== 'github-pages')
upload_to_s3:
runs-on: ubuntu-latest
needs: [build, detect-environments]
strategy:
matrix:
environment: ${{ fromJSON(needs.detect-environments.outputs.environments) }}
environment: ${{ matrix.environment }}
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: main
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.DEPLOY_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DEPLOY_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
- name: Save to S3
run: |
aws s3 sync ./specification s3://${{ secrets.DEPLOY_COLLECTION_DATA_BUCKET }}/specification
check-build-specification-failure:
runs-on: ubuntu-latest
needs:
- build
if: always() && needs.build.result == 'failure' && github.ref == 'refs/heads/main'
steps:
- name: send failure notification
uses: slackapi/slack-github-action@v3.0.3
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload-templated: true
payload: |
channel: planning-data-alerts
text: "Build specification has failed"
icon_emoji: ":rotating_light:"
username: "Build specification"
blocks:
- type: header
text:
type: plain_text
text: "Build specification has failed"
- type: divider
- type: section
text:
type: mrkdwn
text: "The report is available on <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|GitHub>"