-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (57 loc) · 1.85 KB
/
deploy-on-aws.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
name: Build, use AWS EC deploy MkDocs pages
on:
workflow_dispatch:
env:
AWS_REGION: us-east-1
ECR_REPOSITORY: ask-me-picturized
jobs:
# Build job
build:
name: Build Mkdocs pages and upload artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11.2'
# mkdocs build
- name: mkdocs build
run: |
pip install -r requirements.txt
cd readthedocs
mkdocs build -d _site
- uses: actions/upload-artifact@v3
with:
name: mkdocs-artifact
path: ${{ github.workspace }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
# Containerize job to gcloud artifactory registry
containerize-aws-ecr-registry:
name: Publish image to AWS ECR
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v3
with:
name: mkdocs-artifact
path: .
- name: Configure AWS Credentials For GitHub Actions
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
IMAGE_TAG: latest
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build . --file Dockerfile --tag ${{ secrets.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:$IMAGE_TAG
docker push ${{ secrets.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:$IMAGE_TAG