Skip to content

Commit e9c1846

Browse files
committed
feat: workflow init
1 parent 2202f58 commit e9c1846

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/prod-deploy.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
run-name: Deploy to Librarease frontend by @${{ github.actor }}
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: false
15+
16+
jobs:
17+
Build:
18+
name: Build
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- name: Configure AWS credentials
26+
uses: aws-actions/configure-aws-credentials@v1
27+
with:
28+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
29+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
30+
aws-region: ${{ secrets.AWS_REGION }}
31+
32+
- name: export secret key
33+
run: |
34+
echo "${{ vars.production_ENV }}" > .env
35+
36+
- name: Login to Amazon ECR
37+
id: login-ecr
38+
uses: aws-actions/amazon-ecr-login@v1
39+
with:
40+
mask-password: 'true'
41+
42+
# This is a separate action that sets up buildx runner
43+
- name: Setup Docker Buildx
44+
uses: docker/setup-buildx-action@v2
45+
46+
# Use Github action cache
47+
- name: Cache Docker layers
48+
uses: actions/cache@v3
49+
with:
50+
path: /tmp/.buildx-cache
51+
key: ${{ runner.os }}-buildx-${{ github.sha }}
52+
restore-keys: |
53+
${{ runner.os }}-buildx-
54+
55+
- name: Build, tag, and push image to Amazon ECR
56+
id: build-image
57+
env:
58+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
59+
ECR_REPOSITORY: ${{ secrets.REPOSITORY }}
60+
IMAGE_TAG: ${{ vars.IMAGE_TAG }}
61+
run: |
62+
cat .env
63+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
64+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG

0 commit comments

Comments
 (0)