Skip to content

Clone And QA Deploy WordPress Post #24

Clone And QA Deploy WordPress Post

Clone And QA Deploy WordPress Post #24

Workflow file for this run

name: Clone And QA Deploy WordPress Post
on:
workflow_dispatch:
inputs:
environment:
required: true
type: string
description: "The deployment environment (QA, PROD)"
default: "QA"
postID:
required: true
type: string
description: "The ID of the post to clone"
default: "25163"
jobs:
clone_post:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Run cloning script
run: python wordpress-cloning-script.py ${{ inputs.environment }} ${{ inputs.postID }} ${{ secrets.WORDPRESS_USERNAME }} ${{ secrets.WORDPRESS_PASSWORD }}
- name: Configure git user
run: |
git config user.name 'GitHub Actions'
git config user.email '[email protected]'
- name: Commit and push changes
run: |
git add .
# Check if there are any changes
if git diff --staged --quiet; then
echo "No changes to commit."
else
git commit -m "Cloned WordPress post ${{ github.event.inputs.postID }} for environment ${{ github.event.inputs.environment }}"
git push
fi
upload_to_s3:
needs: clone_post
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Upload HTML to S3
uses: jakejarvis/s3-sync-action@master
with:
args: public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: orcid-qa-public-page
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'
SOURCE_DIR: 'dist'