Update platform.sh stores #151
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: Update platform.sh stores | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '30 5 * * 1' | |
push: | |
branches: | |
- main | |
jobs: | |
update_stores: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Install platform CLI | |
run: | | |
curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash | |
- name: Setup SSH key | |
run: | | |
mkdir -p ~/.ssh | |
echo -n '${{ secrets.SSH_KEY }}' > ~/.ssh/id_rsa | |
chmod 0600 ~/.ssh/id_rsa | |
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config | |
- name: Update projects | |
env: | |
PLATFORMSH_CLI_TOKEN: ${{ secrets.PLATFORMSH_CLI_TOKEN }} | |
run: | | |
git config --global user.email "github-ci@boldcommerce.com" | |
git config --global user.name "github-ci" | |
PROJECTS=`platform project:list --pipe` | |
for PROJECT in $PROJECTS; | |
do | |
platform project:get --no-interaction $PROJECT $PROJECT | |
PLATFORM_TYPE=`platform variable:list -p $PROJECT -e main --format plain | awk '/platform:type/ { print $3 }'` | |
if [[ $PLATFORM_TYPE = opencart ]]; then | |
echo "Skipping opencart project $PROJECT" | |
continue | |
else | |
echo "Updating project $PROJECT" | |
fi | |
cd $PROJECT | |
date > timestamp | |
git add timestamp | |
git commit -m "Updating timestamp to force a store deploy" | |
platform push --no-wait | |
cd .. | |
done |