Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow for deploying to a staging website #1704

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions .github/workflows/build-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,43 @@ 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?
#cancel-in-progress: true

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
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/deploy-website-to-staging.yml
Original file line number Diff line number Diff line change
@@ -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'
Loading