set env in ci #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy | |
on: | |
push: | |
branches: | |
- dev | |
- qa | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
environment: ${{ github.event.inputs.environment }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore & Build .Net Core solution | |
run: | | |
dotnet build source/DevSecOpsOne.Api/DevSecOpsOne.Api.csproj | |
- name: Transform Configuration Vars | |
id: set-vars | |
run: | | |
current_branch="${GITHUB_REF#refs/heads/}" | |
aws_region="ap-southeast-1" | |
environment="Dev" | |
app_setting_env="Development" | |
docker_file_path="" | |
service_name="DevSecOps-One" | |
accessKey="${{ secrets.DEV_AWS_ACCESS_KEY }}" | |
secretKey="${{ secrets.DEV_AWS_SECRET_KEY }}" | |
echo "access_key=${accessKey}" >> $GITHUB_OUTPUT | |
echo "secret_key=${secretKey}" >> $GITHUB_OUTPUT | |
echo "aws_region=${aws_region}" >> $GITHUB_OUTPUT | |
echo "environment=${environment}" >> $GITHUB_OUTPUT | |
echo "app_setting_env=${app_setting_env}" >> $GITHUB_OUTPUT | |
echo "current_branch=${current_branch}" >> $GITHUB_OUTPUT | |
echo "service_name=${service_name}" >> $GITHUB_OUTPUT | |
- name: Setup AWS Creds | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_KEY }} | |
aws-region: ap-southeast-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 |