-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (46 loc) · 1.61 KB
/
main.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
on:
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
name: this is a name
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASS }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
pull: true
push: true
cache-from: type=registry,ref=hoantruong6814/iuh-education-fe:latest
cache-to: type=inline
tags: hoantruong6814/iuh-education-fe:latest
- name: Configure AWS credentials from Test account
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Run Command EC2
run: |
aws ssm send-command \
--document-name "AWS-RunShellScript" \
--targets '[{"Key":"InstanceIds","Values":["${{ secrets.INSTANCE_FE_ID }}"]}]' \
--parameters '{"commands":["#!/bin/bash","yum -y update", "cd /home/command", "bash run-command.sh"]}'