-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (63 loc) · 1.96 KB
/
deployment-with-gh-actions.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
name: example dir `deployment-with-github-actions` deployment
on:
push:
branches:
- main # run the workflow when a push is made to the main branch
paths:
- 'deployment-with-github-actions/**'
pull_request:
branches:
- main # run the workflow when the target branch of the PR is main
paths:
- 'deployment-with-github-actions/**'
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
env:
AWS_REGION : 'eu-west-2'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
working-directory: ./deployment-with-github-actions
run: npm ci
- name: Unit test
working-directory: ./deployment-with-github-actions
run: npm run test
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Git clone the repository
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
working-directory: ./deployment-with-github-actions
run: npm ci
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
mask-aws-account-id: true
role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE_ARN }}
role-session-name: github-action-sls-examples
aws-region: ${{ env.AWS_REGION }}
- name: versions
working-directory: ./deployment-with-github-actions
run: |
pwd
node -v
aws --version
- name: deploy
working-directory: ./deployment-with-github-actions
# run: npm run deploy:dev
run: echo "this is a dry run..."