-
Notifications
You must be signed in to change notification settings - Fork 2
110 lines (93 loc) · 4.36 KB
/
ci.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
101
102
103
104
105
106
107
108
109
110
name: ci
on:
push:
branches:
- "**"
workflow_dispatch:
inputs:
deploy-to-dev:
description: "Whether to deploy to dev"
type: boolean
required: true
default: false
defaults:
run:
# NOTE: A bit stricter than the default bash options used by GitHub Actions
# (bash --noprofile --norc -e -o pipefail {0})
shell: bash --noprofile --norc -euo pipefail {0}
# NOTE: Set concurrency for the current workflow to 1
concurrency: ci-${{ github.ref }}-${{ github.workflow }}
jobs:
build-and-deploy:
timeout-minutes: 60
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
id-token: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: capralifecycle/actions-lib/check-runtime-dependencies@a6d9e4b11cdae620cc8e7fcc121de8466f6cfde9 # v1.6.0
- uses: capralifecycle/actions-lib/parse-config@a6d9e4b11cdae620cc8e7fcc121de8466f6cfde9 # v1.6.0
id: config
with:
config-file: ".ldp.json"
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20.9.0
- name: install dependencies
run: npm ci
- name: lint
run: npm run lint
- name: install playwright browsers
run: npx playwright install --with-deps
- name: build
run: npm run build:ci
- name: test
run: npm run test
# - name: test - component
# run: npm run test:component:ci
# - name: test - e2e
# run: npm run test:e2e:ci
- uses: capralifecycle/actions-lib/configure-aws-credentials@a6d9e4b11cdae620cc8e7fcc121de8466f6cfde9 # v1.6.0
id: aws
with:
aws-account-id: ${{ steps.config.outputs.accountId }}
# NOTE: We use different roles on default and non-default branches
aws-iam-role-name: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && steps.config.outputs.roleName || steps.config.outputs.limitedRoleName }}
- uses: capralifecycle/actions-lib/upload-s3-artifact@a6d9e4b11cdae620cc8e7fcc121de8466f6cfde9 # v1.6.0
if: ${{ github.ref == 'refs/heads/master' || inputs.deploy-to-dev }}
id: upload-s3-artifact
env:
AWS_ACCESS_KEY_ID: ${{ steps.aws.outputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ steps.aws.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.aws.outputs.aws-session-token }}
with:
aws-s3-bucket-name: ${{ steps.config.outputs.artifactBucket }}
target-path: "build"
- name: trigger development deployment pipelines
uses: capralifecycle/actions-lib/trigger-deployment-pipeline@a6d9e4b11cdae620cc8e7fcc121de8466f6cfde9 # v1.6.0
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || inputs.deploy-to-dev }}
env:
AWS_ACCESS_KEY_ID: ${{ steps.aws.outputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ steps.aws.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.aws.outputs.aws-session-token }}
with:
pipelines: ${{ steps.config.outputs.devPipelines }}
aws-s3-bucket-name: ${{ steps.config.outputs.artifactBucket }}
trigger-type: "artifact"
# NOTE: The key passed to artifact-parameters will be the name of
# the SSM parameter where the reference to the artifact is stored.
artifact-parameters: "devWebappArtifactS3Key=${{ steps.upload-s3-artifact.outputs.aws-s3-key }}"
- name: trigger production deployment pipelines
uses: capralifecycle/actions-lib/trigger-deployment-pipeline@a6d9e4b11cdae620cc8e7fcc121de8466f6cfde9 # v1.6.0
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
env:
AWS_ACCESS_KEY_ID: ${{ steps.aws.outputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ steps.aws.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.aws.outputs.aws-session-token }}
with:
pipelines: ${{ steps.config.outputs.prodPipelines }}
aws-s3-bucket-name: ${{ steps.config.outputs.artifactBucket }}
trigger-type: "artifact"
artifact-parameters: "prodWebappArtifactS3Key=${{ steps.upload-s3-artifact.outputs.aws-s3-key }}"