-
Notifications
You must be signed in to change notification settings - Fork 5
74 lines (65 loc) · 2.3 KB
/
pubsub_javascript.yaml
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
name: javascript pubsub quickstart
on:
push:
branches: [main]
pull_request:
branches:
- main
paths:
- .github/workflows/pubsub_javascript.yaml
- pubsub/javascript/*
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"
environment: shared-production
# Only run on main repo (not on forks)
if: github.repository_owner == 'diagridio'
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: build local
run: |
cd pubsub/javascript
npm install --prefix ./publisher && npm install --prefix ./subscriber
- name: build publisher container
run: |
cd pubsub/javascript/publisher
docker buildx build --platform linux/amd64 -t pubsub-javascript-publisher .
- name: build subscriber container
run: |
cd pubsub/javascript/subscriber
docker buildx build --platform linux/amd64 -t pubsub-javascript-subscriber .
- name: Configure AWS credentials
if: github.event_name != 'pull_request'
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.AWS_CI_ROLE }}
aws-region: ${{ vars.AWS_CI_REGION }}
- name: Login to Amazon ECR
if: github.event_name != 'pull_request'
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- name: push publisher image
if: github.event_name != 'pull_request'
env:
PUBLIC_ECR: "${{ steps.login-ecr.outputs.registry }}/${{ vars.AWS_PUBLIC_ECR_ALIAS }}/pubsub-javascript-publisher"
run: |
docker tag pubsub-javascript-publisher:latest $PUBLIC_ECR:latest
docker push $PUBLIC_ECR:latest
- name: push subscriber image
if: github.event_name != 'pull_request'
env:
PUBLIC_ECR: "${{ steps.login-ecr.outputs.registry }}/${{ vars.AWS_PUBLIC_ECR_ALIAS }}/pubsub-javascript-subscriber"
run: |
docker tag pubsub-javascript-subscriber:latest $PUBLIC_ECR:latest
docker push $PUBLIC_ECR:latest