diff --git a/.github/workflows/build-website.yml b/.github/workflows/build-website.yml index e3303c5f08..c4e49b84cc 100644 --- a/.github/workflows/build-website.yml +++ b/.github/workflows/build-website.yml @@ -6,6 +6,12 @@ on: schedule: - cron: '0 9,18 * * *' + # Allow this workflow to be reused + workflow_call: + inputs: + environment: + type: string + concurrency: group: website-deployment # TODO: Enable cancel-in-progress once we are deploying per commit? @@ -13,21 +19,30 @@ concurrency: jobs: build_and_deploy: - # Only run this workflow from the trunk branch and when it's triggered by another workflow OR dmsnell OR adamziel - if: > - github.ref == 'refs/heads/trunk' && ( - github.event_name == 'workflow_run' || - github.event_name == 'workflow_dispatch' || - github.actor == 'adamziel' || - github.actor == 'dmsnell' || - github.actor == 'bgrgicak' || - github.actor == 'brandonpayton' - ) + # Only run this workflow when it is: + # - From the trunk branch + # or invoked from another workflow with a non-production environment + # - Triggered by another workflow OR specific Playground maintainers + # if: > + # ( + # github.ref == 'refs/heads/trunk' || + # ( + # github.event_name == 'workflow_call' && + # inputs.environment != 'playground-wordpress-net-wp-cloud' + # ) + # ) && ( + # github.event_name == 'workflow_run' || + # github.event_name == 'workflow_dispatch' || + # github.actor == 'adamziel' || + # github.actor == 'dmsnell' || + # github.actor == 'bgrgicak' || + # github.actor == 'brandonpayton' + # ) # Specify runner + deployment step runs-on: ubuntu-latest environment: - name: playground-wordpress-net-wp-cloud + name: ${{ inputs.environment || 'playground-wordpress-net-wp-cloud' }} steps: - uses: actions/checkout@v3 - uses: ./.github/actions/prepare-playground diff --git a/.github/workflows/deploy-website-to-staging.yml b/.github/workflows/deploy-website-to-staging.yml new file mode 100644 index 0000000000..65d3c4b711 --- /dev/null +++ b/.github/workflows/deploy-website-to-staging.yml @@ -0,0 +1,17 @@ +name: Deploy to wordpress-playground-staging.atomicsites.blog + +on: + workflow_dispatch: + + # TODO: Remove this after testing + pull_request: + +concurrency: + group: staging-website-deployment + +jobs: + deploy-to-staging: + # TODO: Rename main workflow + uses: ./.github/workflows/build-website.yml + with: + environment: 'playground-wordpress-net-wp-cloud-staging'