-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (80 loc) · 2.88 KB
/
Copy pathdeploy-develop.yml
File metadata and controls
89 lines (80 loc) · 2.88 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
name: Deploy to develop
on:
push:
branches:
- main
paths:
- config/parameters/**/develop.json
- config/develop.json
workflow_dispatch:
permissions: {}
concurrency:
group: deploy-develop
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: develop
url: https://dev-www.nationalarchives.gov.uk/
strategy:
matrix:
service:
- frontend
- enrichment
- wagtail
- catalogue
- search
- wagtaildocs
- requestservicerecord
- forms
permissions:
id-token: write
timeout-minutes: 15
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7
with:
aws-region: eu-west-2
role-to-assume: arn:aws:iam::846769538626:role/GithubOIDCProviderIAMRolePermissions-Role-I80RXHT6O1PL
role-session-name: GitHubActionsSession
- name: Update SSM parameters
uses: ./.github/actions/update-environment-variables
with:
service-name: ${{ matrix.service }}
environment: develop
parameter-path: /application/web/${{ matrix.service }}
- name: Deploy service
uses: ./.github/actions/deploy
with:
config-file: develop.json
service-name: ${{ matrix.service }}
parameter-path: /application/web/${{ matrix.service }}/docker_images
deployed-parameter-path: /application/web/${{ matrix.service }}/deployed_version
tests:
runs-on: ubuntu-latest
needs:
- deploy
env:
GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN_TEST_RUNNER }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Run tests
run: |
HOUR=$(date +"%H")
DAY_OF_WEEK=$(date +%u)
if [ "$HOUR" -ge 7 ] && [ "$HOUR" -le 19 ] && [ "$DAY_OF_WEEK" -ge 1 ] && [ "$DAY_OF_WEEK" -le 5 ];
then
echo "Running tests during working hours"
gh workflow run run.yml --repo nationalarchives/ds-tna-website-tests --field environment=develop --raw-field exclude-tests="@wip" --field notify-slack-on-pass=false --field notify-slack-on-fail=true --raw-field description="$(git log -1 --pretty=%B | sed '/./,$!d' | sed '/^$/d' | sed 's/^/> /')"
sleep 5
gh run watch --exit-status --repo nationalarchives/ds-tna-website-tests $(gh run list --repo nationalarchives/ds-tna-website-tests --workflow run.yml -L1 --json databaseId --jq .[0].databaseId)
else
echo "Skipping tests outside working hours"
fi