Skip to content

Commit

Permalink
continue
Browse files Browse the repository at this point in the history
  • Loading branch information
MotwaniM committed Mar 22, 2024
1 parent 78ed88b commit 5b5256f
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 66 deletions.
130 changes: 65 additions & 65 deletions .github/workflows/build-gh.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@

name: build
on:
push:
branches:
- "**"
# name: build
# on:
# push:
# branches:
# - "**"


jobs:
set-vars:
runs-on: ubuntu-latest
outputs:
app-name: ${{ steps.export.outputs.app-name }}
ec2-instance-type: ${{ steps.export.outputs.ec2-instance-type }}
version: ${{ steps.export.outputs.version }}
runner_label: ${{ steps.export.outputs.runner_label }}
environment: ${{ steps.export.outputs.environment }}
# jobs:
# set-vars:
# runs-on: ubuntu-latest
# outputs:
# app-name: ${{ steps.export.outputs.app-name }}
# ec2-instance-type: ${{ steps.export.outputs.ec2-instance-type }}
# version: ${{ steps.export.outputs.version }}
# runner_label: ${{ steps.export.outputs.runner_label }}
# environment: ${{ steps.export.outputs.environment }}


steps:
- name: Checkout
uses: actions/checkout@v3
- id: export
run: |
. ./.github/.github.env
echo "ec2-instance-type=${EC2_INSTANCE_TYPE}" >> $GITHUB_OUTPUT
echo "app-name=${APP_NAME}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "environment=${ENVIRONMENT}" >> $GITHUB_OUTPUT
echo "RUNNER_LABEL=self-hosted" >> $GITHUB_OUTPUT
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - id: export
# run: |
# . ./.github/.github.env
# echo "ec2-instance-type=${EC2_INSTANCE_TYPE}" >> $GITHUB_OUTPUT
# echo "app-name=${APP_NAME}" >> $GITHUB_OUTPUT
# echo "version=${VERSION}" >> $GITHUB_OUTPUT
# echo "environment=${ENVIRONMENT}" >> $GITHUB_OUTPUT
# echo "RUNNER_LABEL=self-hosted" >> $GITHUB_OUTPUT

start-runner:
uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/start-runner.yml@feature/apply-terraform
needs: set-vars
with:
EC2_INSTANCE_TYPE: ${{ needs.set-vars.outputs.ec2-instance-type }}
ENVIRONMENT: ${{ needs.set-vars.outputs.environment }}
secrets:
AWS_GITHUBRUNNER_USER_ACCESS_KEY: ${{ secrets.AWS_GITHUBRUNNER_USER_ACCESS_KEY }}
AWS_GITHUBRUNNER_USER_SECRET_ID: ${{ secrets.AWS_GITHUBRUNNER_USER_SECRET_ID }}
AWS_GITHUBRUNNER_PAT: ${{ secrets.AWS_GITHUBRUNNER_PAT}}
AWS_REGION: ${{ secrets.AWS_REGION }}
# start-runner:
# uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/start-runner.yml@feature/apply-terraform
# needs: set-vars
# with:
# EC2_INSTANCE_TYPE: ${{ needs.set-vars.outputs.ec2-instance-type }}
# ENVIRONMENT: ${{ needs.set-vars.outputs.environment }}
# secrets:
# AWS_GITHUBRUNNER_USER_ACCESS_KEY: ${{ secrets.AWS_GITHUBRUNNER_USER_ACCESS_KEY }}
# AWS_GITHUBRUNNER_USER_SECRET_ID: ${{ secrets.AWS_GITHUBRUNNER_USER_SECRET_ID }}
# AWS_GITHUBRUNNER_PAT: ${{ secrets.AWS_GITHUBRUNNER_PAT}}
# AWS_REGION: ${{ secrets.AWS_REGION }}

build-image:
needs:
- set-vars
- start-runner
uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/build-docker.yml@feature/apply-terraform
with:
APP_NAME: ${{ needs.set-vars.outputs.app-name }}
RUNNER_LABEL: ${{ needs.set-vars.outputs.runner_label }}
INFRASTRUCTURE_FOLDER: "infrastructure"
secrets:
AWS_GITHUBRUNNER_PAT: ${{ secrets.AWS_GITHUBRUNNER_PAT}}
AWS_GITHUBRUNNER_PAT_USER: ${{ secrets.AWS_GITHUBRUNNER_PAT_USER }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
# build-image:
# needs:
# - set-vars
# - start-runner
# uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/build-docker.yml@feature/apply-terraform
# with:
# APP_NAME: ${{ needs.set-vars.outputs.app-name }}
# RUNNER_LABEL: ${{ needs.set-vars.outputs.runner_label }}
# INFRASTRUCTURE_FOLDER: "infrastructure"
# secrets:
# AWS_GITHUBRUNNER_PAT: ${{ secrets.AWS_GITHUBRUNNER_PAT}}
# AWS_GITHUBRUNNER_PAT_USER: ${{ secrets.AWS_GITHUBRUNNER_PAT_USER }}
# AWS_REGION: ${{ secrets.AWS_REGION }}
# AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}


stop-runner:
uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/stop-runner.yml@feature/apply-terraform
if: needs.start-runner.outputs.use-persisted == 0 && always()
needs:
- set-vars
- start-runner
- build-image
with:
RUNNER_LABEL: ${{ needs.start-runner.outputs.label }}
EC2_INSTANCE_ID: ${{ needs.start-runner.outputs.ec2-instance-id }}
secrets:
AWS_GITHUBRUNNER_USER_ACCESS_KEY: ${{ secrets.AWS_GITHUBRUNNER_USER_ACCESS_KEY }}
AWS_GITHUBRUNNER_USER_SECRET_ID: ${{ secrets.AWS_GITHUBRUNNER_USER_SECRET_ID }}
AWS_GITHUBRUNNER_PAT: ${{ secrets.AWS_GITHUBRUNNER_PAT}}
AWS_REGION: ${{ secrets.AWS_REGION }}
# stop-runner:
# uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/stop-runner.yml@feature/apply-terraform
# if: needs.start-runner.outputs.use-persisted == 0 && always()
# needs:
# - set-vars
# - start-runner
# - build-image
# with:
# RUNNER_LABEL: ${{ needs.start-runner.outputs.label }}
# EC2_INSTANCE_ID: ${{ needs.start-runner.outputs.ec2-instance-id }}
# secrets:
# AWS_GITHUBRUNNER_USER_ACCESS_KEY: ${{ secrets.AWS_GITHUBRUNNER_USER_ACCESS_KEY }}
# AWS_GITHUBRUNNER_USER_SECRET_ID: ${{ secrets.AWS_GITHUBRUNNER_USER_SECRET_ID }}
# AWS_GITHUBRUNNER_PAT: ${{ secrets.AWS_GITHUBRUNNER_PAT}}
# AWS_REGION: ${{ secrets.AWS_REGION }}
3 changes: 2 additions & 1 deletion .github/workflows/build-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ jobs:
echo "infra-config-repo=${INFRA_CONFIG_REPO}" >> $GITHUB_OUTPUT
echo "environment=${ENVIRONMENT}" >> $GITHUB_OUTPUT
echo "::add-mask::${AWS_REGION}"
echo $ENVIRONMENT
start-runner:
uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/start-runner.yml@feature/apply-terraform
needs: set-vars
with:
EC2_INSTANCE_TYPE: ${{ needs.set-vars.outputs.ec2-instance-type }}
ENVIRONMENT: "dev"
ENVIRONMENT: ${{ needs.set-vars.outputs.environment }}
secrets:
AWS_GITHUBRUNNER_USER_ACCESS_KEY: ${{ secrets.AWS_GITHUBRUNNER_USER_ACCESS_KEY }}
AWS_GITHUBRUNNER_USER_SECRET_ID: ${{ secrets.AWS_GITHUBRUNNER_USER_SECRET_ID }}
Expand Down

0 comments on commit 5b5256f

Please sign in to comment.