Merge pull request #275 from CityOfBoston/deploy_prod/DIG-4742 #66
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
# @file: prep_3_s3_deploy.yml | |
# This actions will (force) push changes to deploy-branches if the corresponding config file changes | |
# | |
name: "(Force) Push Changes to deploy-branches" | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
# pull_request: | |
# branches: | |
# - master | |
jobs: | |
Deploy: | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Get all changed config files | |
id: changed-config-files | |
uses: tj-actions/changed-files@v44 | |
with: | |
# Avoid using single or double quotes for multiline patterns | |
files: | | |
**.yaml | |
- name: (Force) Push to Deploy Branches | |
if: steps.changed-config-files.outputs.any_changed == 'true' | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-config-files.outputs.all_changed_files }} | |
ACTOR: ${{ github.actor }} | |
EMAIL: "${{ github.actor }}@users.noreply.github.com" | |
run: | | |
if [[ ${#ALL_CHANGED_FILES[@]} -gt 0 ]] | |
then | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
if [[ $file == src/configs/test/apps.yaml ]] | |
then | |
TARGET=deploy-test | |
fi | |
if [[ $file == src/configs/dev/apps.yaml ]] | |
then | |
TARGET=deploy-dev | |
fi | |
if [[ $file == src/configs/prod/apps.yaml ]] | |
then | |
TARGET=deploy-prod | |
fi | |
echo "TARGET_BRANCH Below:" | |
echo "$TARGET | ${TARGET}" | |
echo "Actor: $ACTOR" | |
echo "EMAIL: $EMAIL" | |
git config --global user.name "$ACTOR" | |
git config --global user.email "$EMAIL" | |
echo "git config user.name: [$(git config user.name)]" | |
echo "git config user.email: [$(git config user.email)]" | |
git checkout -b ${TARGET} | |
git push -uf --no-verify origin ${TARGET} | |
done | |
fi |