Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Access Secrets based on environments segregate #231

Merged
merged 4 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions .github/workflows/deploy_mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,33 @@ on:
description: deploy v2
type: string

run-name: Deploy Explorer-Indexer to Mainnet - ${{ inputs.release_tag }} by @${{ github.actor }}

env:
AWS_REGION: '${{ secrets.AWS_REGION }}'
ENVIRONMENT: MAINNET
AWS_MAINNET: '${{ secrets.AWS_MAINNET }}'
REGISTRY: 'ghcr.io'
VERSION: ${{ inputs.release_tag }}

jobs:
deploy:
name: deploy
runs-on: ubuntu-latest

environment: mainnet
permissions:
contents: read
id-token: write
actions: write

env:
AWS_REGION: '${{ secrets.AWS_REGION }}'
AWS_MAINNET: '${{ secrets.AWS_MAINNET }}'
steps:
- name: Authorised User only
run: |
if [[ ! " tcar121293 eedygreen MakMuftic akchainsafe mpetrun5 " =~ " ${{ github.actor }} " ]]; then
echo "You are not authorized to deploy to mainnet!"
exit 1
fi

- name: checkout ecs repo
uses: actions/checkout@v4
with:
Expand All @@ -46,8 +55,8 @@ jobs:
awsAccountId=${{ env.AWS_MAINNET }}
awsRegion=${{ env.AWS_REGION }}
awsEnv=${{ env.ENVIRONMENT }}
DB_USERNAME=${{ secrets.MAIN_USERNAME }}
DB_PASSWORD=${{ secrets.MAIN_PASSWORD }}
DB_USERNAME=${{ secrets.DB_USERNAME }}
DB_PASSWORD=${{ secrets.DB_PASSWORD }}
imageTag=${{ env.VERSION }}

- name: Configure AWS Credentials
Expand Down Expand Up @@ -78,12 +87,14 @@ jobs:
# name: deploy v2

# runs-on: ubuntu-latest

# environment: mainnet
# permissions:
# contents: read
# id-token: write
# actions: write

# env:
# AWS_REGION: '${{ secrets.AWS_REGION }}'
# AWS_MAINNET: '${{ secrets.AWS_MAINNET }}'
# steps:
# - name: checkout ecs repo
# uses: actions/checkout@v4
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/deploy_mainnet_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,33 @@ on:
default: 'stable'
type: string

run-name: Deploy Explorer-API to Mainnet - ${{ inputs.release_tag }} by @${{ github.actor }}

env:
AWS_REGION: '${{ secrets.AWS_REGION }}'
ENVIRONMENT: MAINNET
AWS_MAINNET: '${{ secrets.AWS_MAINNET }}'
REGISTRY: 'ghcr.io'
VERSION: ${{ inputs.release_tag }}

jobs:
deploy:
name: deploy
runs-on: ubuntu-latest

environment: mainnet
permissions:
contents: read
id-token: write
actions: write

env:
AWS_REGION: '${{ secrets.AWS_REGION }}'
AWS_MAINNET: '${{ secrets.AWS_MAINNET }}'
steps:
- name: Authorised User only
run: |
if [[ ! " tcar121293 eedygreen MakMuftic akchainsafe mpetrun5 " =~ " ${{ github.actor }} " ]]; then
echo "You are not authorized to deploy to mainnet!"
exit 1
fi

- name: checkout ecs repo
uses: actions/checkout@v4
with:
Expand All @@ -44,8 +53,8 @@ jobs:
awsAccountId=${{ env.AWS_MAINNET }}
awsRegion=${{ env.AWS_REGION }}
awsEnv=${{ env.ENVIRONMENT }}
DB_USERNAME=${{ secrets.MAIN_USERNAME }}
DB_PASSWORD=${{ secrets.MAIN_PASSWORD }}
DB_USERNAME=${{ secrets.DB_USERNAME }}
DB_PASSWORD=${{ secrets.DB_PASSWORD }}
imageTag=${{ env.VERSION }}

- name: Configure AWS Credentials
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/deploy_testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
types:
- published

run-name: Deploy Explorer-Indexer to Testnet - ${{ inputs.release_tag }} by @${{ github.actor }}

env:
AWS_REGION: '${{ secrets.AWS_REGION }}'
ENVIRONMENT: TESTNET
AWS_TESTNET: '${{ secrets.AWS_ARN }}'
REGISTRY: 'ghcr.io'
TAG: 'stable'
VERSION: ${{ github.event.release.tag_name }}
Expand Down Expand Up @@ -59,12 +59,14 @@ jobs:
needs: push
name: deploy
runs-on: ubuntu-latest

environment: testnet
permissions:
contents: read
id-token: write
actions: write

env:
AWS_REGION: '${{ secrets.AWS_REGION }}'
AWS_TESTNET: '${{ secrets.AWS_ARN }}'
steps:
- name: checkout ecs repo
uses: actions/checkout@v4
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/deploy_testnet_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
types:
- published

run-name: Deploy Explorer-API to Testnet - ${{ inputs.release_tag }} by @${{ github.actor }}

env:
AWS_REGION: '${{ secrets.AWS_REGION }}'
ENVIRONMENT: TESTNET
AWS_TESTNET: '${{ secrets.AWS_ARN }}'
REGISTRY: 'ghcr.io'
TAG: 'stable'
VERSION: ${{ github.event.release.tag_name }}
Expand Down Expand Up @@ -61,12 +61,14 @@ jobs:
needs: push
name: deploy
runs-on: ubuntu-latest

environment: testnet
permissions:
contents: read
id-token: write
actions: write

env:
AWS_TESTNET: '${{ secrets.AWS_ARN }}'
AWS_REGION: '${{ secrets.AWS_REGION }}'
steps:
- name: checkout ecs repo
uses: actions/checkout@v4
Expand Down
Loading