-
Notifications
You must be signed in to change notification settings - Fork 2
114 lines (96 loc) · 3.21 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
111
112
113
114
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
pull-requests: write
repository-projects: write
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
environment: dev
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.REPO_PAT }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Configure git
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Build and test
run: |
corepack enable
pnpm install --frozen-lockfile --ignore-scripts
pnpm nx affected --base=last-release -t format:check --parallel=3
pnpm nx affected --base=last-release -t build --parallel=3
pnpm nx affected --base=last-release -t lint --parallel=3
pnpm nx affected --base=last-release -t test --parallel=3
- name: Create Figma tokens flat artifact
uses: actions/upload-artifact@v4
with:
name: figma-tokens
path: packages/design/figma/dist/tokens
- name: Create Figma tokens flat artifact
uses: actions/upload-artifact@v4
with:
name: figma-tokens-flat
path: packages/design/figma/dist/tokens-flat
- name: Version
if: github.ref == 'refs/heads/main'
run: |
pnpm nx affected --base=last-release -t version --parallel=1
env:
GITHUB_TOKEN: ${{ secrets.REPO_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Setup AWS ECR Details
if: github.ref == 'refs/heads/main'
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Sign in to Amazon ECR
if: github.ref == 'refs/heads/main'
id: ecr-sign-in
uses: aws-actions/amazon-ecr-login@v2
- name: Set up Docker Buildx
if: github.ref == 'refs/heads/main'
uses: docker/setup-buildx-action@v3
- name: Build and push docker
if: github.ref == 'refs/heads/main'
env:
ECR_REGISTRY: ${{ steps.ecr-sign-in.outputs.registry }}
ECR_REPOSITORY: life-events-design-system
IMAGE_TAG: latest # TODO: env vars in Nx project.json
run: |
pnpm nx affected --base=last-release -t docker --parallel=1
- name: Deploy to ECS
if: github.ref == 'refs/heads/main'
env:
CLUSTER_NAME: life-events-ecs
SERVICE_NAME: design-system-service
run: |
aws ecs update-service --cluster $CLUSTER_NAME --service $SERVICE_NAME --force-new-deployment
- name: Tag last-release
if: github.ref == 'refs/heads/main'
shell: bash
run: |
git tag -f last-release
git push origin last-release --force