-
Notifications
You must be signed in to change notification settings - Fork 87
99 lines (99 loc) · 3.54 KB
/
cd_prd.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#on:
# push:
# branches:
# - main
# paths-ignore:
# - '**.md'
# - 'examples/**'
#name: Publishing promethai-backend Docker image to prd ECR
#
#env:
# AWS_ROLE_DEV_CICD: "arn:aws:iam::463722570299:role/promethai-dev-base-role-github-ci-cd"
# AWS_ACCOUNT_ID_DEV: "463722570299"
# ENVIRONMENT: prd
#
#jobs:
#
# publish_docker_to_ecr:
# name: Publish Docker PromethAI image
# runs-on: ubuntu-latest
# permissions:
# id-token: write
# contents: read
# steps:
# - name: Take code from repo
# uses: actions/checkout@v3
# - name: Set environment variable for stage
# id: set-env
# run: |
# if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
# echo "STAGE=prd" >> $GITHUB_ENV
# echo "::set-output name=stage::prd"
# else
# echo "STAGE=dev" >> $GITHUB_ENV
# echo "::set-output name=stage::dev"
# fi
# - name: Use output
# run: echo "The stage is ${{ steps.set-env.outputs.stage }}"
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# role-to-assume: ${{ env.AWS_ROLE_DEV_CICD }}
# aws-region: eu-west-1
# - name: Create Docker image and push to ECR
# uses: ./.github/actions/image_builder
# id: generate-promethai-docker
# with:
# stage: prd
# aws_account_id: ${{ env.AWS_ACCOUNT_ID_DEV }}
# should_publish: true
# ecr_image_repo_name: promethai-prd-backend-promethai-backend
# dockerfile_location: ./
# - name: Export Docker image tag
# id: export-promethai-docker-tag
# run: |
# export DOCKER_TAG=$(cat /tmp/.DOCKER_IMAGE_VERSION)
# echo "Docker tag is: $DOCKER_TAG"
# echo "promethai_docker_tag_backend=$DOCKER_TAG" >> $GITHUB_OUTPUT
#
## - name: Create Tag and Release
## runs-on: ubuntu-latest
## uses: actions/checkout@v3
## needs: publish_docker_to_ecr # ensure this job runs after Docker image is pushed
## steps:
## - name: Check out code
## uses: actions/checkout@v3
## - name: Bump version and push tag
## id: bump_version_and_push_tag
## uses: anothrNick/[email protected]
## env:
## GITHUB_TOKEN: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }}
## WITH_V: true
## DEFAULT_BUMP: 'minor' # or 'minor' or 'major'
## - name: Create Release
## id: create_release
## uses: actions/create-release@v1
## env:
## GITHUB_TOKEN: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }}
## with:
## tag_name: ${{ steps.bump_version_and_push_tag.outputs.tag }}
## release_name: Release ${{ steps.bump_version_and_push_tag.outputs.tag }}
# outputs:
# promethai_docker_tag_backend: ${{ steps.export-promethai-docker-tag.outputs.promethai_docker_tag_backend }}
#
# apply_tf:
# name: Trigger terraform apply workflow
# runs-on: ubuntu-latest
# needs: publish_docker_to_ecr
# steps:
# - name: TF apply workflow triggers step
# uses: actions/github-script@v6
# with:
# github-token: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }}
# script: |
# await github.rest.actions.createWorkflowDispatch({
# owner: 'topoteretes',
# repo: 'PromethAI-Infra',
# workflow_id: 'terraform.apply.yml',
# ref: 'main'
# })