added python3.12 #171
Workflow file for this run
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: Push To Master | |
on: | |
push: | |
branches: | |
- master | |
- klayers-default | |
- klayers-dev | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
# if: github.event.pull_request.merged == true # only if merged | |
steps: | |
- name: Set up Git repository | |
uses: actions/checkout@v3 | |
- name: Set AWS Environment variable based on branch | |
run: | | |
if [ ${{ github.ref }} == refs/heads/klayers-default ] | |
then | |
echo AWS_ENV=Klayers-defaultp38 >> $GITHUB_ENV | |
elif [ ${{ github.ref }} == refs/heads/klayers-dev ] | |
then | |
echo AWS_ENV=Klayers-devp38 >> $GITHUB_ENV | |
elif [ ${{ github.ref }} == refs/heads/master ] | |
then | |
echo AWS_ENV=Klayers-prodp38 >> $GITHUB_ENV | |
else | |
exit 1 | |
fi | |
APP_NAME=$(cat ./pipeline/Terraform/terraform.tfvars.json | jq -r '.app_name') | |
echo APP_NAME=$APP_NAME >> $GITHUB_ENV | |
shell: bash | |
- name: Get AWS configuration | |
run: | | |
GITHUB_ROLE_ARN=$(cat ./.github/workflows/role_arns.json | jq -r --arg arg $AWS_ENV '.github_role_arn | .[$arg]') | |
AWS_REGION=$(cat ./pipeline/Terraform/terraform.tfvars.json | jq -r --arg arg $AWS_ENV '.aws_region | .[$arg]') | |
echo AWS_ROLE_ARN=$GITHUB_ROLE_ARN >> $GITHUB_ENV | |
echo AWS_DEFAULT_REGION=$AWS_REGION >> $GITHUB_ENV | |
shell: bash | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
role-to-assume: ${{ env.AWS_ROLE_ARN }} | |
role-duration-seconds: 1200 | |
role-session-name: on-push-klayers-${{ env.AWS_ENV }} | |
- name: Bucket Parameter | |
run: | | |
BUCKET_PARAMETER_SUFFIX=$(cat ./pipeline/Terraform/terraform.tfvars.json | jq -r '.s3bucket_config_parameter_name_suffix') | |
echo CONFIG_BUCKET_PARAMETER_NAME=/$APP_NAME/$AWS_ENV/$BUCKET_PARAMETER_SUFFIX >> $GITHUB_ENV | |
- name: Get Bucket name | |
run: | | |
export CONFIG_BUCKET_NAME=$(aws ssm get-parameter --name $CONFIG_BUCKET_PARAMETER_NAME | jq -r ".Parameter.Value") | |
echo CONFIG_BUCKET_NAME=$CONFIG_BUCKET_NAME >> $GITHUB_ENV | |
- name: Upload new configuration to S3 | |
run: | | |
CONFIG_DIR=$(cat ./pipeline/Terraform/terraform.tfvars.json | jq -r --arg arg $AWS_ENV '.config_dir | .[$arg]') | |
echo $CONFIG_DIR | |
aws s3 cp $CONFIG_DIR s3://$CONFIG_BUCKET_NAME --recursive | |
- name: Invoke Pipeline with entire github event | |
run: | | |
STATE_MACHINE_ARN=$(aws ssm get-parameter --name "/gh-push/$AWS_ENV/PipelineArn" | jq -r ".Parameter.Value") | |
aws stepfunctions start-execution --state-machine-arn $STATE_MACHINE_ARN --input file://${{ github.event_path }} |