forked from aws-solutions/serverless-image-handler
-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (57 loc) · 1.65 KB
/
deploy.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
name: main
on:
push:
branches:
- main
paths-ignore:
- "**.tf"
pull_request:
branches:
- main
paths-ignore:
- "**.tf"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
# read+write needed for `aws-actions/configure-aws-credentials` to work
permissions:
id-token: write
contents: read
jobs:
image-handler:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest-arm64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: install
run: make npm/install
- name: install
run: make npm/test
- name: build
run: make build
- name: configure aws credentials
# 📌 Runs only if:
# 1. is a 'push to main'
# 2. did not run in a fork
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'stroeer' }}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::053041861227:role/github-s3-access-eu-west-1
role-session-name: GitHubActions
aws-region: eu-west-1
- name: s3 upload artefact
# 📌 Runs only if:
# 1. is a 'push to main'
# 2. did not run in a fork
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'stroeer' }}
run: make deploy