[
  {
    "path": ".changeset/config.json",
    "content": "{\n  \"$schema\": \"https://unpkg.com/@changesets/config@2.1.0/schema.json\",\n  \"changelog\": \"@changesets/cli/changelog\",\n  \"commit\": false,\n  \"fixed\": [],\n  \"linked\": [],\n  \"access\": \"restricted\",\n  \"baseBranch\": \"main\",\n  \"updateInternalDependencies\": \"patch\",\n  \"ignore\": []\n}"
  },
  {
    "path": ".github/CODEOWNERS",
    "content": "*           @wpengine/mario\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Describe the bug**\nA clear and concise description of the bug goes here.\n\n### To reproduce\nAny steps, flags, details that can help the team reproduce the issue.\n\n### Expected behavior\nA clear and concise description of what you expected to happen.\n\n### Build Output & Screenshots\nOptionally add the relevant build output and screenshots to help explain your problem.\n\n### Version information\n- Action version: x.x.x\n- Git version: x.x.x\n- WordPress version: x.x.x\n- Operating system:\n\n### Additional context\nAdd any other context about the problem here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "content": "blank_issues_enabled: true\ncontact_links:\n  - name: Feature requests\n    url: https://github.com/wpengine/github-action-wpe-site-deploy/discussions/new\n    about: Create a new discussion in the \"Ideas\" category\n  - name: Help requests\n    url: https://my.wpengine.com/support\n    about: Contact WP Engine live chat support for help with configuration or troubleshooting"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "# JIRA Ticket\n\n[MARIO-1234](https://wpengine.atlassian.net/browse/MARIO-1234)\n\n## What Are We Doing Here\n\nHere is where you should describe the problem you are solving, adding any fine details on the solution that might\notherwise not be recognizable for someone unfamiliar with the changes. Add some pictures if it helps.\n"
  },
  {
    "path": ".github/SUPPORT.md",
    "content": "# Support\n\nWP Engine is committed to supporting and maintaining the functionality and security of the Site Deploy GitHub Action.\n\n- Questions concerning action configuration and troubleshooting may be raised via [WP Engine live chat support](https://my.wpengine.com/support).\n- Bug reports may be submitted as [issues](https://github.com/wpengine/github-action-wpe-site-deploy/issues/new?assignees=&labels=&template=bug_report.md&title=).\n- Feature requests can be submitted as a [new discussion](https://github.com/wpengine/github-action-wpe-site-deploy/discussions/new) in the \"Ideas\" category."
  },
  {
    "path": ".github/actions/get-release-notes/action.yml",
    "content": "name: Get release notes\ndescription: Retrieves the release notes for a given version from the changelog.\ninputs:\n  version:\n    description: \"Which version's release notes to retrieve.\"\n    required: true\n  changelog:\n    description: \"Path to the changelog.\"\n    required: true\noutputs:\n  release_notes:\n    description: \"Release notes parsed from the changelog.\"\n    value: ${{ steps.notes.outputs.RELEASE_NOTES }}\nruns:\n  using: 'composite'\n  steps:\n    - id: notes\n      run: |\n          notes=$(node ${{ github.action_path }}/getReleaseNotes ${{ inputs.version }} ${{ inputs.changelog }})\n          echo \"RELEASE_NOTES<<EOF\" >> $GITHUB_OUTPUT\n          echo \"$notes\" >> $GITHUB_OUTPUT\n          echo \"EOF\" >> $GITHUB_OUTPUT\n      shell: bash"
  },
  {
    "path": ".github/actions/get-release-notes/getReleaseNotes.js",
    "content": "#! /usr/bin/env node\n\nconst [,, ...args] = process.argv;\n\nconst fs = require('fs/promises');\nconst path = require(\"path\");\n\nconst readFile = (filename) => fs.readFile(filename, { encoding: \"utf8\" });\n\n(async ()=>{\n    if (! args[0] || ! args[1] ) {\n        printUsageInstructions();\n        process.exit(1);\n    }\n\n    const notes = await getReleaseNotes(args[0], args[1]);\n\n    process.stdout.write(notes);\n})();\n\n/**\n * Retrieves the changelog entry for a particular version.\n * \n * Expects the changelog to be a markdown file as generated by Changesets.\n *\n * @param {String} version       The version number to get notes for.\n * @param {String} changelogPath Path to the CHANGELOG.md file.\n */\nasync function getReleaseNotes(version, changelogPath) {\n    changelogPath = path.resolve(changelogPath);\n\n    let changelog = await readFile(changelogPath);\n\n    const versionStart = changelog.indexOf(`## ${version}`);\n\n    if ( versionStart < 0 ) {\n        throw new Error(`Version ${version} does not exist in ${changelogPath}`);\n    }\n\n    changelog = changelog.substring( versionStart );\n\n    // split the contents by new line\n    const changelogLines = changelog.split(/\\r?\\n/);\n    // we don't need the version heading in release notes, so drop the first line\n    changelogLines.shift();\n    const processedLines = [];\n\n    // print all lines in current version\n    changelogLines.every((line) => {\n      // Version numbers in CHANGELOG.md are h2, so we've hit the next version\n      if (line.startsWith(\"## \")) {\n          return false;\n      }\n\n      if (line.startsWith(\"### \")) {\n        // Make h3 into h2\n        line = line.replace(\"### \", \"## \");\n      }\n\n      processedLines.push(line);\n\n      return true;\n    });\n\n    return processedLines.join(\"\\n\");\n}\n\nfunction printUsageInstructions() {\n    usage =  \"Usage: node getReleaseNotes <version> <changelogPath>\\n\";\n    usage += \"\\n\";\n    usage += \"Example use:\\n\";\n    usage += \"  node getReleaseNotes 3.0.1 ../CHANGELOG.md\\n\";\n    console.info(usage);\n}"
  },
  {
    "path": ".github/actions/publish/action.yml",
    "content": "name: Publish release tags\ndescription: Ensures major, minor, and patch version tags for a given version.\ninputs:\n  version:\n    description: 'Patch version to publish.'\n    required: true\noutputs:\n  published:\n    description: 'Whether a new version was published.'\n    value: ${{ steps.publish.outputs.PUBLISHED }}\nruns:\n  using: 'composite'\n  steps:\n    - id: publish\n      run: \"${{ github.action_path }}/publish.sh ${{ inputs.version }}\"\n      shell: bash"
  },
  {
    "path": ".github/actions/publish/publish.sh",
    "content": "#!/bin/bash\n\nset -e\n\nprint_usage_instructions() {\n    echo \"Usage: bash publish.sh <version>\";\n    echo \"\";\n    echo \"Example use:\";\n    echo \"  bash publish.sh 3.1.1\";\n    exit 1\n}\n\nif [ $# -eq 0 ]; then\n    print_usage_instructions\nfi\n\nversion=\"$1\"\n\n# We will only handle versions >= v1 in the format {MAJOR}.{MINOR}?.{PATCH}?\n#   capture 1: major number\n#   capture 2: minor number with dot\n#   capture 3: minor number without dot\n#   capture 4: patch number with dot\n#   capture 5: patch number without dot\nVERSION_REGEX=\"^([1-9][0-9]*)(\\.(0|[1-9][0-9]*)){0,1}(\\.(0|[1-9][0-9]*)){0,1}$\"\nPUBLISHED='false'\n\nif [[ \"$version\" =~ $VERSION_REGEX ]] ; then\n    majorTag=\"v${BASH_REMATCH[1]}\"\n    minorTag=\"$majorTag.${BASH_REMATCH[3]:-0}\"\n    patchTag=\"$minorTag.${BASH_REMATCH[5]:-0}\"\n    tagsToUpdate=(\"$majorTag\" \"$minorTag\")\nelse\n    echo \"Provided version does not match the format \\\"{MAJOR}.{MINOR}?.{PATCH}?\\\". Skipping tag updates.\"\n    exit 0\nfi\n\nif [ \"$(git tag -l \"$patchTag\")\" ]; then\n    echo \"Version $patchTag has already been released! Skipping tag updates.\"\n    exit 0\nelse \n    echo \"Creating tag: $patchTag\"\n    git tag -a \"$patchTag\" -m \" Release $patchTag\"\n    git push origin \"$patchTag\"\n    PUBLISHED='true'\nfi\n\nfor tag in \"${tagsToUpdate[@]}\"; do\n    message=\"Release $patchTag\"\n\n    if [ \"$(git tag -l \"$tag\")\" ]; then\n        echo \"Updating tag: $tag\"\n        message=\"Update to $patchTag\"\n    else\n        echo \"Creating tag: $tag\"\n    fi\n\n    git tag -fa \"$tag\" -m \"$message\"\n    git push origin \"$tag\" --force\ndone\n\necho \"PUBLISHED=$PUBLISHED\" >> $GITHUB_OUTPUT"
  },
  {
    "path": ".github/workflows/e2e-deploy.yml",
    "content": "name: Test e2e Deploy to WP Engine\non:\n  schedule:\n    - cron: '*/60 * * * *'\n  push:\n    branches:\n      - main\n  pull_request:\n    branches:\n      - main\n\nconcurrency:\n  group: ${{ github.workflow }}-main\n  cancel-in-progress: false\n\njobs:\n  run_action:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - name: Bump test plugin version number\n        run: sed -i 's/0.0.1/0.0.2/' tests/data/plugins/test-plugin/test-plugin.php\n      - name: GitHub Action Deploy to WP Engine\n        uses: ./\n        with:\n          # Deploy vars\n          WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }}\n          WPE_ENV: ghae2e\n          # Deploy Options\n          SRC_PATH: \"tests/data/plugins/test-plugin\"\n          REMOTE_PATH: \"wp-content/plugins/\"\n          PHP_LINT: true\n          FLAGS: -r --backup --backup-dir=/tmp --itemize-changes\n          SCRIPT: \"tests/data/post-deploy/test-plugin.sh\"\n          CACHE_CLEAR: true\n      - name: Fetch deploy results\n        id: fetchResult\n        uses: fjogeleit/http-request-action@v1\n        with:\n          url: \"https://ghae2e.wpengine.com/wp-content/plugins/test-plugin/status.json\"\n      - name: Validate deploy results\n        run: |\n          [ ${{ fromJson(steps.fetchResult.outputs.response).status }} = \"success\" ] || exit 1\n"
  },
  {
    "path": ".github/workflows/lint-files.yml",
    "content": "---\nname: Lint GHA Files\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    branches:\n      - main\n\njobs:\n  lint:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Lint files\n        uses: actions/checkout@v4\n      - run: echo \"Running shell script lint!\"\n      - run: find . -name \"*.sh\" -type f | xargs -I {} shellcheck --severity=error {}\n      - run: echo \"Running yml file lint!\"\n      - run: find . -name \"*.yml\" -type f | xargs -I {} yamllint {}\n"
  },
  {
    "path": ".github/workflows/release.yml",
    "content": "name: Version and Release\n\non:\n  push:\n    branches:\n      - main\n\nconcurrency: ${{ github.workflow }}-${{ github.ref }}\n\njobs:\n  versioning:\n    name: Versioning\n    runs-on: ubuntu-latest\n    outputs:\n      hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}\n      version: ${{ steps.version.outputs.CURRENT_VERSION }}\n    steps:\n      - name: Checkout Repo\n        uses: actions/checkout@v4\n\n      - name: Setup Node.js 20.x\n        uses: actions/setup-node@v4\n        with:\n          node-version: 20.x\n\n      - name: Install Dependencies\n        run: npm ci\n\n      - name: Create Release Pull Request\n        id: changesets\n        uses: changesets/action@v1\n        with:\n          commit: \"Version Action\"\n          title: \"Version Action\"\n          version: npm run version\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n\n      - name: Get current version\n        id: version\n        run: echo \"CURRENT_VERSION=$(node -p \"require('./package.json').version\")\" >> $GITHUB_OUTPUT\n\n  release:\n    name: Release\n    runs-on: ubuntu-latest\n    needs: versioning\n    if: needs.versioning.outputs.hasChangesets == 'false'\n    steps:\n      - name: Checkout Repo\n        uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n\n      - name: Configure git\n        run: |\n          git config user.name github-actions[bot]\n          git config user.email github-actions[bot]@users.noreply.github.com\n\n      - name: Setup Node.js 20.x\n        uses: actions/setup-node@v4\n        with:\n          node-version: 20.x\n\n      - name: Publish tags\n        id: publish\n        uses: ./.github/actions/publish\n        with:\n          version: ${{ needs.versioning.outputs.version }}\n\n      - name: Get release notes\n        id: notes\n        if: steps.publish.outputs.published == 'true'\n        uses: ./.github/actions/get-release-notes\n        with:\n          version: ${{ needs.versioning.outputs.version }}\n          changelog: ./CHANGELOG.md\n\n      - name: Create release\n        if: steps.notes.outputs.release_notes\n        uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5\n        with:\n          body: ${{ steps.notes.outputs.release_notes }}\n          tag_name: v${{ needs.versioning.outputs.version }}\n"
  },
  {
    "path": ".github/workflows/sonar.yml",
    "content": "on:\n  # Trigger analysis for pushes and pull requests\n  push:\n    branches:\n      - main\n  pull_request:\n    types: [opened, synchronize, reopened]\n\nname: SonarQube\njobs:\n  domino_quality_gate:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n        with:\n          # Fetch full history for better SCM information\n          fetch-depth: 0\n\n      - name: Run SonarQube Scan\n        uses: sonarsource/sonarqube-scan-action@master\n        env:\n          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n          SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}\n\n      - name: Quality Gate Check\n        uses: sonarsource/sonarqube-quality-gate-action@master\n        timeout-minutes: 5\n        env:\n          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n          SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}\n"
  },
  {
    "path": ".gitignore",
    "content": "node_modules\n.DS_Store\n"
  },
  {
    "path": ".npmrc",
    "content": "engine-strict=true"
  },
  {
    "path": ".nvmrc",
    "content": "v20"
  },
  {
    "path": ".yamllint",
    "content": "---\nrules:\n  line-length:\n    max: 120\n  truthy: {check-keys: false}"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# @wpengine/github-action-wpe-site-deploy\n\n## 3.2.9\n\n### Patch Changes\n\n- cbc333d: Bump wpengine/site-deploy image version [1.0.7](https://github.com/wpengine/site-deploy/releases/tag/v1.0.7)\n\n## 3.2.8\n\n### Patch Changes\n\n- d903a96: Bump wpengine/site-deploy image version [1.0.6](https://github.com/wpengine/site-deploy/releases/tag/v1.0.6)\n\n## 3.2.7\n\n### Patch Changes\n\n- 1de7e02: Bump wpengine/site-deploy image version [1.0.5](https://github.com/wpengine/site-deploy/releases/tag/v1.0.5)\n\n## 3.2.6\n\n### Patch Changes\n\n- 0a8b985: Bump wpengine/site-deploy image version 1.0.4\n\n## 3.2.5\n\n### Patch Changes\n\n- 24a71db: Update wpengine/site-deploy image to 1.0.3\n\n## 3.2.4\n\n### Patch Changes\n\n- 34b3009: Update link to exclude.txt\n- 1a754af: Bump @changesets/cli > 2.26.2 (resolves semver vulnerability)\n- 4e010b0: Update wpengine/site-deploy image to 1.0.2\n\n## 3.2.3\n\n### Patch Changes\n\n- 2bc933a: Update wpengine/site-deploy image to 1.0.1\n\n## 3.2.2\n\n### Patch Changes\n\n- 42002e5: Fixes an issue in v3.2.1 where the action may fail to resolve the public Docker image\n\n## 3.2.1\n\n### Patch Changes\n\n- cecc467: [CICD-217] Replace split image with site-deploy combined image\n\n## 3.2.0\n\n### Minor Changes\n\n- 24c8aaf: Add CDN cache clearing ability to the CACHE_CLEAR flag.\n\n### Patch Changes\n\n- 7301b87: Improve performance by utilizing pre-built Docker Image.\n\n## 3.1.1\n\n### Patch Changes\n\n- 0da65a6: Prevent plugin and theme conflicts from adversely affecting cache clear\n\n## 3.1.0\n\n### Minor Changes\n\n- 559547c: Copy post-deploy `SCRIPT` to the remote if it exists in the repo but not on the remote. This allows for storing script files outside of `SRC_PATH`. [#12](https://github.com/wpengine/github-action-wpe-site-deploy/pull/12)\n\n### Patch Changes\n\n- 559547c: Fix action failures caused by attempts to rsync wpe-cache-plugin [#8](https://github.com/wpengine/github-action-wpe-site-deploy/pull/8)\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\n\nThanks for your interest in contributing! There are several ways to get involved:\n\n- Discuss open [issues](https://github.com/wpengine/github-action-wpe-site-deploy/issues).\n- Submit [bugs](https://github.com/wpengine/github-action-wpe-site-deploy/issues/new?assignees=&labels=&template=bug_report.md&title=) and help us verify fixes as they are checked in.\n- Open or participate in [discussions](https://github.com/wpengine/github-action-wpe-site-deploy/discussions) regarding feature requests.\n"
  },
  {
    "path": "DEVELOPMENT.md",
    "content": "# Development\n\n## Getting Started\n\nBefore you get started, we recommend installing [Node Version Manager](https://github.com/nvm-sh/nvm#installing-and-updating) to help manage `node` and `npm` versions. Next, from your local copy of the action run `nvm use` and `npm install`. You're ready to start coding!\n\n## Git Workflows\n\nWe use the [feature branch workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow). The workflow for a typical code change looks like this:\n\n1. Create a new branch for the feature.\n2. Make changes to the code.\n3. Use `npx changeset` to create a changeset describing the change to users.\n4. Commit your changes.\n5. Open a pull request to the `main` branch.\n6. Once all checks are passing and the PR is approved, Squash and Merge into the `main` branch.\n\n## Updating the Docker Image\n\nThe docker image that this action relies on is managed in https://github.com/wpengine/site-deploy. After a new `wpengine/site-deploy` image is released and tagged:\n\n1. Create a new branch.\n2. Update the tag in [./action.yml](./action.yml).\n3. Use `npx changeset` to create a changeset describing the change to users.\n4. Commit your changes.\n5. Open a pull request to the `main` branch.\n6. Once all checks are passing and the PR is approved, Squash and Merge into the `main` branch.\n\n## Creating a release\n\nWe use [Changesets](https://github.com/changesets/changesets) to automate versioning and releasing.\n\n1. Go to pull requests and view the automated \"Version Action\" PR.\n2. Review the PR:\n    - [ ] Changelog entries were created.\n    - [ ] Version number in package.json was bumped.\n    - [ ] All `.changeset/*.md` files were removed.\n3. Approve, then \"Squash and merge\" the PR into `main`.\n\nMerging the versioning PR will run a workflow that creates or updates all necessary tags. It will also create a new release in GitHub.\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2021 WP Engine\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "\n![WP Engine GitHub Actions Site Deployment](docs/images/banner.jpg)\n\n[![Test e2e Deploy to WP Engine](https://github.com/wpengine/github-action-wpe-site-deploy/actions/workflows/e2e-deploy.yml/badge.svg)](https://github.com/wpengine/github-action-wpe-site-deploy/actions/workflows/e2e-deploy.yml)  [![Lint GHA Files](https://github.com/wpengine/github-action-wpe-site-deploy/actions/workflows/lint-files.yml/badge.svg)](https://github.com/wpengine/github-action-wpe-site-deploy/actions/workflows/lint-files.yml)  [![Version and Release](https://github.com/wpengine/github-action-wpe-site-deploy/actions/workflows/release.yml/badge.svg)](https://github.com/wpengine/github-action-wpe-site-deploy/actions/workflows/release.yml)\n\n# WP Engine GitHub Action for Site Deployment\n\nUse this GitHub Action to deploy code from a GitHub repo to a WP Engine environment of your choosing. If you do not have a WP Engine Account, [click here to get started!](https://wpengine.com/plans/?utm_content=wpe_gha) If you do have an account, check out our guided [step-by-step instructions](https://my.wpengine.com/profile/github_action).\n\nThis action enables you to:\n  * Deploy a full site directory or subdirectory of your WordPress install\n  * Perform a PHP Lint\n  * Customize rsync flags\n  * Clear cache\n  * Execute a post-deploy script of your choosing\n\n## Setup Instructions\n\n\n1. **SSH PUBLIC KEY SETUP IN WP ENGINE**\n* [Generate a new SSH key pair](https://wpengine.com/support/ssh-keys-for-shell-access/#Generate_New_SSH_Key?utm_content=wpe_gha) if you have not already done so. Please note that this SSH Key needs to be *passwordless*.\n\n* Add *SSH Public Key* to WP Engine SSH Gateway Key settings. [This Guide will show you how.](https://wpengine.com/support/ssh-gateway/#Add_SSH_Key?utm_content=wpe_gha)\n\n2. **SSH PRIVATE KEY SETUP IN GITHUB**\n\n* Add the *SSH Private Key* to your [Repository Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) or your [Organization Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-an-organization). Save the new secret \"Name\" as `WPE_SSHG_KEY_PRIVATE`.\n\n3. **YML SETUP**\n\n* Create `.github/workflows/main.yml` directory and file locally.\nCopy and paste the configuration from below, replacing the value under `branches:` and the value for `WPE_ENV:`.\n\n* To deploy from another branch, simply create another yml file locally for that branch, such as `.github/workflows/stage.yml` and replace the values for `branches:` and  `WPE_ENV:` for that workflow.\n\nThis provides the ability to perform a different workflow for different branches/environments. Consult [\"Environment Variable & Secrets\"](#environment-variables--secrets) for more available options.\n\n4. Git push your site GitHub repo. The action will do the rest!\n\nView your actions progress and logs by navigating to the \"Actions\" tab in your repo.\n\n## Example GitHub Action workflow\n\n### Simple main.yml:\n\n```yml\nname: Deploy to WP Engine\non:\n  push:\n    branches:\n     - main\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n    - name: GitHub Action Deploy to WP Engine\n      uses: wpengine/github-action-wpe-site-deploy@v3\n      with:\n        WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }}\n        WPE_ENV: <your_install_name_here>\n```\n\n### Extended main.yml\n\n```yml\nname: Deploy to WP Engine\non:\n  push:\n    branches:\n     - main\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n    - name: GitHub Action Deploy to WP Engine\n      uses: wpengine/github-action-wpe-site-deploy@v3\n      with:\n        # Deploy vars\n        WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }}\n        WPE_ENV: <your_install_name_here>\n        # Deploy Options\n        SRC_PATH: \"wp-content/themes/genesis-child-theme/\"\n        REMOTE_PATH: \"wp-content/themes/genesis-child-theme/\"\n        PHP_LINT: TRUE\n        FLAGS: -azvr --inplace --delete --exclude=.*  --exclude=wp-content/mu-plugins/local-plugin --exclude-from=.deployignore\n        SCRIPT: \"path/yourscript.sh\"\n        CACHE_CLEAR: TRUE\n```\n\n## Environment Variables & Secrets\n\n### Required\n\n| Name | Type | Usage |\n|-|-|-|\n| `WPE_SSHG_KEY_PRIVATE` | secrets | Private SSH Key for the SSH Gateway and deployment. See below for SSH key usage. |\n\n### Deploy Options\n\n| Name          | Type   | Usage                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |\n|---------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `WPE_ENV`     | string | Insert the name of the WP Engine environment you want to deploy to. This also has an alias of `PRD_ENV`, `STG_ENV`, or `DEV_ENV` for multi-step workflows.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |\n| `SRC_PATH`    | string | Optional path to specify a directory within the repo to deploy from. Ex. `\"wp-content/themes/genesis-child-theme/\"`. Defaults to root of repo filesystem as source.</br></br>**Note:** Including a trailing slash ensures that the contents of the specified directory are copied, while omitting the trailing slash results in the directory itself being copied, including its contents.                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |\n| `REMOTE_PATH` | string | Optional path to specify a directory destination to deploy to. Ex. `\"wp-content/themes/genesis-child-theme/\"` . Defaults to WordPress root directory on WP Engine.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |\n| `PHP_LINT`    | bool   | Set to TRUE to execute a php lint on your branch pre-deployment. Default is `FALSE`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| `FLAGS`       | string | Set optional rsync flags such as `--delete` or `--exclude-from`. The extended example above is excluding paths specified in a `.deployignore` file in the root of the repo. This action defaults to a non-destructive deploy.<br /><br />For flags that contain whitespace, use single quotes around the flag's value:<br /><br />`FLAGS: -azvr --filter=':- .gitignore'`<br /><br /> For flags that do not contain whitespace, quotes are unnecessary.<br /><br /> **Default:** `-azvr --inplace --exclude=.*` <br /><br />_Caution: Setting custom rsync flags replaces the default flags provided by this action. Consider also adding the `-azvr` flags as needed.<br /> `-a` preserves symbolic links, timestamps, user permissions and ownership.<br /> `-z` is for compression <br /> `-v` is for verbose output<br /> `-r` is for recursive directory scanning_ |\n| `SCRIPT`      | string | Remote bash file to execute post-deploy. This can include WP_CLI commands for example. Path is relative to the WP root and file executes on remote. This file can be included in your repo, or be a persistent file that lives on your server.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |\n| `CACHE_CLEAR` | bool   | Optionally clear page and CDN cache post deploy. This takes a few seconds. Default is TRUE.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\n\n\n\n\n### Further reading\n\n* **NOTE:** This Action DOES NOT utilize WP Engine GitPush or the GitPush SSH keys [found here.](https://wpengine.com/support/git/#Add_SSH_Key_to_User_Portal?utm_content=wpe_gha)\n* **TIP:** If using a GitHub Organization, adding the SSH key to the [Organization Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-an-organization) will allow all repos to reference the same SSH key for deploys using the method in the sample `main.yml`. The SSH Key also connects to all installs made available to its WP Engine User. One key can then effectively be used to deploy all projects to their respective sites on WP Engine. Less work. More deploys!\n* [Defining environment variables in GitHub Actions](https://docs.github.com/en/actions/reference/environment-variables)\n* [Storing secrets in GitHub repositories](https://docs.github.com/en/actions/reference/encrypted-secrets)\n* It is recommended to leverage one of [WP Engine's .gitignore templates.](https://wpengine.com/support/git/#Add_gitignore?utm_content=wpe_gha)\n* This action excludes several files and directories from the deploy by default. See the [exclude_from_root.txt](https://github.com/wpengine/site-deploy/blob/main/tests/fixtures/excludes/exclude_from_root.txt) for reference.\n\n## Versioning\n\nWe follow [SemVer](https://semver.org/) and [GitHub's action versioning recommendations](https://github.com/actions/toolkit/blob/01e1ff7bc04e1c57c980a0d1530478a5b60cf812/docs/action-versioning.md) for maintaining major, minor, and patch [version tags](https://github.com/wpengine/github-action-wpe-site-deploy/tags). Patch tags (e.g. `v1.1.1`) are created for each release and will not move once created. Major tags (e.g. `v1`) and minor tags (e.g. `v1.1`) will be updated to track their respective latest versions.\n\nWe recommend binding this action to the latest major tag so that you will receive backwards compatible updates.\n"
  },
  {
    "path": "SECURITY.md",
    "content": "# Security\n\nAt WP Engine, we take security seriously. We appreciate our community’s involvement in finding and fixing security issues on our platform.\n\n## Reporting a Security Issue\n\nIf you have found a security vulnerability or other security issue on WP Engine and are a WP Engine customer, please [contact WP Engine support](https://my.wpengine.com/support?#general-issue).\n\nIf you are not a WP Engine customer, please submit security vulnerabilities or other security issues via our Intigriti Vulnerability Disclosure Program at https://app.intigriti.com/programs/wpengine/wpengine/detail.\n\nA member of our security or support team will follow up with you regarding the issue shortly.\n\nThank you for reporting your security concern with us!"
  },
  {
    "path": "action.yml",
    "content": "---\nname: \"Deploy WordPress to WP Engine\"\nbranding:\n  icon: \"upload-cloud\"\n  color: \"blue\"\ndescription: \"Deploy WordPress projects to a WP Engine account using SSH Gateway\"\ninputs:\n  WPE_SSHG_KEY_PRIVATE:\n    description: \"The private RSA key you will save in the Github Secrets\"\n    required: true\n  PHP_LINT:\n    description: \"optional php syntax check\"\n    required: false\n    default: false\n  FLAGS:\n    description: \"Optional flags for the deployment\"\n    required: true\n    default: '-azvr --inplace --exclude=\".*\"'\n  CACHE_CLEAR:\n    description: \"Optional WPE Clear cache\"\n    required: false\n    default: true\n  SRC_PATH:\n    description: \"An optional source directory to deploy other than the root directory that is being versioned.\"\n    default: \".\"\n    required: false\n  REMOTE_PATH:\n    description: \"An optional destination directory to deploy to other than the WordPress root.\"\n    default: \"\"\n    required: false\n  WPE_ENV:\n    description: \"Destination to deploy to WPE\"\n    required: false\n  PRD_ENV:\n    description: \"Destination to deploy to WPE Prod\"\n    required: false\n  STG_ENV:\n    description: \"Destination to deploy to WPE Stage\"\n    required: false\n  DEV_ENV:\n    description: \"Destination to deploy to WPE Dev\"\n    required: false\n  SCRIPT:\n    description: \"File containing custom scripts run after the rsync\"\n    required: false\n\nruns:\n  using: \"docker\"\n  image: docker://wpengine/site-deploy:1.0.7\n  env:\n    WPE_SSHG_KEY_PRIVATE: ${{ inputs.WPE_SSHG_KEY_PRIVATE }}\n    WPE_ENV: ${{ inputs.WPE_ENV }}\n    PRD_ENV: ${{ inputs.PRD_ENV }}\n    STG_ENV: ${{ inputs.STG_ENV }}\n    DEV_ENV: ${{ inputs.DEV_ENV }}\n    REMOTE_PATH: ${{ inputs.REMOTE_PATH }}\n    SRC_PATH: ${{ inputs.SRC_PATH }}\n    FLAGS: ${{ inputs.FLAGS }}\n    PHP_LINT: ${{ inputs.PHP_LINT }}\n    CACHE_CLEAR: ${{ inputs.CACHE_CLEAR }}\n    SCRIPT: ${{ inputs.SCRIPT }}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"@wpengine/github-action-wpe-site-deploy\",\n  \"version\": \"3.2.9\",\n  \"private\": true,\n  \"engines\": {\n    \"node\": \">=20\",\n    \"npm\": \">=9\"\n  },\n  \"dependencies\": {},\n  \"devDependencies\": {\n    \"@changesets/cli\": \"^2.29.8\"\n  },\n  \"scripts\": {\n    \"version\": \"changeset version && npm install --package-lock-only\"\n  }\n}\n"
  },
  {
    "path": "sonar-project.properties",
    "content": "# Server and project configuration\nsonar.projectVersion=1.0-beta\nsonar.sourceEncoding=UTF-8\nsonar.scm.provider=git\n\n# Project identifiers\nsonar.projectName=github-action-wpe-site-deploy\nsonar.projectKey=wpengine_github-action-wpe-site-deploy_2cd09997-922e-4fc9-b1ba-46178d41a6ce\n\n# Individual configurations\n# Paths to source code directories (use relative paths)\nsonar.sources=.\n\n# # Additional parameters for advanced configurations\n# sonar.exclusions=**/docs/**, **/tests/**, **/node_modules/**\n"
  },
  {
    "path": "tests/data/plugins/test-plugin/test-plugin.php",
    "content": "<?php\n/**\n * Plugin Name: Deploy WordPress to WP Engine - e2e Test\n * Plugin URI: https://github.com/wpengine/github-action-wpe-site-deploy\n * Description: Sample code to test the Site Deployment GitHub Action by WP Engine.\n * Version: 0.0.1\n */\n \n add_action('init', 'register_my_cpt');\n\n function register_my_cpt() {\n    register_post_type('my-cpt', array(\n        'public' => true\n    ));\n }"
  },
  {
    "path": "tests/data/post-deploy/test-plugin.sh",
    "content": "#!/bin/sh\n\nBACKUP_DIR=/tmp\nPLUGINS_DIR=wp-content/plugins\nPLUGIN_NAME=test-plugin\nSTATUS_FILE=status.json\n\ncleanup() {\n    rm tests/data/post-deploy/test-plugin.sh\n}\ntrap cleanup EXIT\n\n# Get the the new plugin version\nAFTER_PLUGIN_VERSION=$(wp plugin get $PLUGIN_NAME | sed -n \"/version/p\" | cut -f2)\necho \"New test plugin version: $AFTER_PLUGIN_VERSION\"\n\n# Revert to backup created by rsync if it exists\nif [ -d $BACKUP_DIR/$PLUGIN_NAME ]; then\n    rm -rf $PLUGINS_DIR/$PLUGIN_NAME && mv $BACKUP_DIR/$PLUGIN_NAME $PLUGINS_DIR/\nfi\n\n# Get the old plugin version\nBEFORE_PLUGIN_VERSION=$(wp plugin get $PLUGIN_NAME | sed -n \"/version/p\" | cut -f2)\necho \"Old test plugin version: $BEFORE_PLUGIN_VERSION\"\n\n# Check that the expected update was made\nif [ -z \"$BEFORE_PLUGIN_VERSION\" ] || [ -z \"$AFTER_PLUGIN_VERSION\" ] || [ \"$BEFORE_PLUGIN_VERSION\" = \"$AFTER_PLUGIN_VERSION\" ]; then\n    echo \"Failure: Test plugin was not updated!\"\n    echo \"{\\\"status\\\": \\\"failure\\\"}\" > $PLUGINS_DIR/$PLUGIN_NAME/$STATUS_FILE\nelse\n    echo \"Success: Test plugin successfully updated from $BEFORE_PLUGIN_VERSION to $AFTER_PLUGIN_VERSION!\"\n    echo \"{\\\"status\\\": \\\"success\\\"}\" > $PLUGINS_DIR/$PLUGIN_NAME/$STATUS_FILE\nfi"
  }
]