Skip to content

追加4

追加4 #8

Workflow file for this run

name: glue-job
on:
pull_request:
branches:
- 'beta/**'
- 'PB/**'
paths:
- 'glue-job/**'
push:
branches:
- 'feature/*'
- 'beta/*'
paths:
- 'glue-job/**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Checkout the repository with full history
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch full history to enable git diff
# Install AWS CLI
- name: Install AWS CLI
run: |
sudo apt-get update
sudo apt-get install -y awscli
# Configure AWS credentials
- name: Configure AWS credentials
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CODEBUILD_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CODEBUILD_AWS_SECRET_ACCESS_KEY }}
run: |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
aws configure set region ap-northeast-1
- name: Set WORKSPACE and DIRECTORY variable
run: |
echo "DIRECTORY=${{ inputs.directory }}" >> $GITHUB_ENV
if [[ "${{ github.ref }}" == refs/heads/beta/* ]]; then
echo "WORKSPACE=beta" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == refs/heads/feature/* ]]; then
echo "WORKSPACE=e" >> $GITHUB_ENV
fi
- name: Set ORGCODE based on changed directory
id: set_orgcode
run: |
# Get list of changed files
CHANGED_FILES=$(git diff --name-only HEAD^ HEAD)
# Check for changes in glue-job directory
for file in $CHANGED_FILES; do
if [[ $file == glue-job/* ]]; then
# Extract the directory name from glue-job/<directory>
ORGCODE=$(echo $file | cut -d'/' -f2)
echo "ORGCODE=$ORGCODE" >> $GITHUB_ENV
break
fi
done
- name: Conditional steps for push events
if: github.event_name == 'push'
run: |
aws s3 rm s3://touchgift-script-glue-staging-${{ env.WORKSPACE }}/job.py
aws s3 cp glue-job/${{ env.ORGCODE }}/staging/${{ env.WORKSPACE }}/evserver/job.py s3://touchgift-script-glue-staging-${{ env.WORKSPACE }}/job.py