fix: prd github workflow

This commit is contained in:
Boris Arzentar 2024-10-16 21:19:31 +02:00
parent 1eb4429c5c
commit 2485eb76fa
2 changed files with 74 additions and 68 deletions

View file

@ -7,6 +7,7 @@ on:
- feature/* - feature/*
paths-ignore: paths-ignore:
- '**.md' - '**.md'
- 'examples/**'
env: env:
AWS_ROLE_DEV_CICD: "arn:aws:iam::463722570299:role/cognee-dev-base-role-github-ci-cd" AWS_ROLE_DEV_CICD: "arn:aws:iam::463722570299:role/cognee-dev-base-role-github-ci-cd"
@ -76,7 +77,7 @@ jobs:
script: | script: |
await github.rest.actions.createWorkflowDispatch({ await github.rest.actions.createWorkflowDispatch({
owner: 'topoteretes', owner: 'topoteretes',
repo: 'PromethAI-Infra', repo: 'cognee-infra',
workflow_id: 'terraform.apply.yml', workflow_id: 'terraform.apply.yml',
ref: 'main' ref: 'main'
}) })

View file

@ -22,8 +22,9 @@ jobs:
id-token: write id-token: write
contents: read contents: read
steps: steps:
- name: Take code from repo - name: Checkout code from repo
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Set environment variable for stage - name: Set environment variable for stage
id: set-env id: set-env
run: | run: |
@ -34,68 +35,72 @@ jobs:
echo "STAGE=dev" >> $GITHUB_ENV echo "STAGE=dev" >> $GITHUB_ENV
echo "::set-output name=stage::dev" echo "::set-output name=stage::dev"
fi fi
# - name: Use output
# run: echo "The stage is ${{ steps.set-env.outputs.stage }}" - name: Use output
# - name: Configure AWS credentials run: echo "The stage is ${{ steps.set-env.outputs.stage }}"
# uses: aws-actions/configure-aws-credentials@v1
# with: - name: Configure AWS credentials
# role-to-assume: ${{ env.AWS_ROLE_DEV_CICD }} uses: aws-actions/configure-aws-credentials@v4
# aws-region: eu-west-1 with:
# - name: Create Docker image and push to ECR role-to-assume: ${{ env.AWS_ROLE_DEV_CICD }}
# uses: ./.github/actions/image_builder aws-region: eu-west-1
# id: generate-promethai-docker
# with: - name: Build Docker image and push to ECR
# stage: prd uses: ./.github/actions/image_builder
# aws_account_id: ${{ env.AWS_ACCOUNT_ID_DEV }} id: generate-promethai-docker
# should_publish: true with:
# ecr_image_repo_name: promethai-prd-backend-promethai-backend stage: prd
# # ecr_image_repo_name: cognee-prd-backend-cognee-ecr aws_account_id: ${{ env.AWS_ACCOUNT_ID_DEV }}
# dockerfile_location: ./ should_publish: true
# - name: Export Docker image tag ecr_image_repo_name: cognee-prd-backend-cognee-ecr
# id: export-promethai-docker-tag dockerfile_location: ./
# run: |
# export DOCKER_TAG=$(cat /tmp/.DOCKER_IMAGE_VERSION) - name: Export Docker image tag
# echo "Docker tag is: $DOCKER_TAG" id: export-cognee-docker-tag
# echo "promethai_docker_tag_backend=$DOCKER_TAG" >> $GITHUB_OUTPUT run: |
# export DOCKER_TAG=$(cat /tmp/.DOCKER_IMAGE_VERSION)
## - name: Create Tag and Release echo "Docker tag is: $DOCKER_TAG"
## runs-on: ubuntu-latest echo "cognee_image_tag=$DOCKER_TAG" >> $GITHUB_OUTPUT
## uses: actions/checkout@v3
## needs: publish_docker_to_ecr # ensure this job runs after Docker image is pushed # - name: Create Tag and Release
## steps: # runs-on: ubuntu-latest
## - name: Check out code # uses: actions/checkout@v3
## uses: actions/checkout@v3 # needs: publish_docker_to_ecr # ensure this job runs after Docker image is pushed
## - name: Bump version and push tag # steps:
## id: bump_version_and_push_tag # - name: Check out code
## uses: anothrNick/github-tag-action@1.34.0 # uses: actions/checkout@v3
## env: # - name: Bump version and push tag
## GITHUB_TOKEN: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }} # id: bump_version_and_push_tag
## WITH_V: true # uses: anothrNick/github-tag-action@1.34.0
## DEFAULT_BUMP: 'minor' # or 'minor' or 'major' # env:
## - name: Create Release # GITHUB_TOKEN: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }}
## id: create_release # WITH_V: true
## uses: actions/create-release@v1 # DEFAULT_BUMP: 'minor' # or 'minor' or 'major'
## env: # - name: Create Release
## GITHUB_TOKEN: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }} # id: create_release
## with: # uses: actions/create-release@v1
## tag_name: ${{ steps.bump_version_and_push_tag.outputs.tag }} # env:
## release_name: Release ${{ steps.bump_version_and_push_tag.outputs.tag }} # GITHUB_TOKEN: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }}
# outputs: # with:
# promethai_docker_tag_backend: ${{ steps.export-promethai-docker-tag.outputs.promethai_docker_tag_backend }} # tag_name: ${{ steps.bump_version_and_push_tag.outputs.tag }}
# # release_name: Release ${{ steps.bump_version_and_push_tag.outputs.tag }}
# apply_tf:
# name: Trigger terraform apply workflow outputs:
# runs-on: ubuntu-latest cognee_image_tag: ${{ steps.export-promethai-docker-tag.outputs.cognee_image_tag }}
# needs: publish_docker_to_ecr
# steps: trigger_deployment:
# - name: TF apply workflow triggers step name: Trigger deployment
# uses: actions/github-script@v6 runs-on: ubuntu-latest
# with: needs: publish_docker_to_ecr
# github-token: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }} steps:
# script: | - name: TF apply workflow triggers step
# await github.rest.actions.createWorkflowDispatch({ uses: actions/github-script@v7
# owner: 'topoteretes', with:
# repo: 'PromethAI-Infra', github-token: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }}
# workflow_id: 'terraform.apply.yml', script: |
# ref: 'main' await github.rest.actions.createWorkflowDispatch({
# }) owner: 'topoteretes',
repo: 'cognee-infra',
workflow_id: 'terraform.apply.yml',
ref: 'main'
})