From 8985907991e2c98824d7b8a6f13c3645b99bef77 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 20:36:33 +0000 Subject: [PATCH 1/5] Initial plan From 1ed8a587f7d883fba46e713e49f2e7aec4dc5fa3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 20:40:24 +0000 Subject: [PATCH 2/5] Add GitHub Deployments tracking to deployment workflow Co-authored-by: tiffehr <60173+tiffehr@users.noreply.github.com> --- .github/workflows/deploy.yml | 89 ++++++++++++++++++++++++++++++++++++ README.md | 7 ++- 2 files changed, 95 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 31d47544..80114ce2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,6 +9,7 @@ on: permissions: contents: read id-token: write # Required for OIDC authentication + deployments: write # Required for creating deployments jobs: deploy: @@ -56,6 +57,40 @@ jobs: aws-region: us-east-1 role-session-name: Deploy-${{ github.event.repository.name }}-${{ github.run_id }} + - name: Create GitHub Deployment (Staging) + if: github.ref == 'refs/heads/staging' + id: deployment-staging + uses: actions/github-script@v7 + with: + script: | + const deployment = await github.rest.repos.createDeployment({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: context.sha, + environment: 'staging', + description: `Deploy staging site to S3`, + auto_merge: false, + required_contexts: [] + }); + return deployment.data.id; + + - name: Create GitHub Deployment (Production) + if: github.ref == 'refs/heads/main' + id: deployment-production + uses: actions/github-script@v7 + with: + script: | + const deployment = await github.rest.repos.createDeployment({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: context.sha, + environment: 'production', + description: `Deploy production site to S3 and CloudFront`, + auto_merge: false, + required_contexts: [] + }); + return deployment.data.id; + - name: Deploy to S3 (Staging) if: github.ref == 'refs/heads/staging' run: | @@ -76,3 +111,57 @@ jobs: aws cloudfront create-invalidation \ --distribution-id ${{ steps.config.outputs.cloudfront }} \ --paths "/*" + + - name: Update Deployment Status (Staging Success) + if: github.ref == 'refs/heads/staging' && success() + uses: actions/github-script@v7 + with: + script: | + await github.rest.repos.createDeploymentStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + deployment_id: ${{ steps.deployment-staging.outputs.result }}, + state: 'success', + environment_url: 'http://${{ steps.config.outputs.staging_bucket }}', + description: 'Staging deployment completed successfully' + }); + + - name: Update Deployment Status (Production Success) + if: github.ref == 'refs/heads/main' && success() + uses: actions/github-script@v7 + with: + script: | + await github.rest.repos.createDeploymentStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + deployment_id: ${{ steps.deployment-production.outputs.result }}, + state: 'success', + environment_url: 'https://${{ steps.config.outputs.bucket }}', + description: 'Production deployment completed successfully' + }); + + - name: Update Deployment Status (Staging Failure) + if: github.ref == 'refs/heads/staging' && failure() + uses: actions/github-script@v7 + with: + script: | + await github.rest.repos.createDeploymentStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + deployment_id: ${{ steps.deployment-staging.outputs.result }}, + state: 'failure', + description: 'Staging deployment failed' + }); + + - name: Update Deployment Status (Production Failure) + if: github.ref == 'refs/heads/main' && failure() + uses: actions/github-script@v7 + with: + script: | + await github.rest.repos.createDeploymentStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + deployment_id: ${{ steps.deployment-production.outputs.result }}, + state: 'failure', + description: 'Production deployment failed' + }); diff --git a/README.md b/README.md index 102a7cb0..a6f71aa3 100644 --- a/README.md +++ b/README.md @@ -110,11 +110,14 @@ This project uses GitHub Actions for automated deployment to AWS S3 and CloudFro - `staging` → Staging deployment (S3 only) - Other branches → Test builds only (no deployment) +All deployments are tracked in GitHub's **Deployments** tab, making it easy to see deployment history, status, and environment URLs. + ### Pushing to staging - When you're ready to have someone review a site update, update the `staging` branch in GitHub. If you're working in `staging` locally, you just need to push your code changes. If you're working in a separate feature branch, push that branch to GitHub and then open a pull request into `staging` and merge it. - A commit to the `staging` branch on GitHub will trigger an automatic build of the SRCCON staging site via GitHub Actions. - The GitHub Actions workflow can take a minute or two to complete. Your changes will not be visible on the staging site immediately, but they'll be there quickly. +- **View deployment status:** Check the repository's [Deployments](../../deployments) tab to see the deployment history and status. ### Pushing to production @@ -122,6 +125,7 @@ This project uses GitHub Actions for automated deployment to AWS S3 and CloudFro - **Optional QA step:** Run `bundle exec rake review:compare_deployed_sites` to see a detailed comparison of staging vs production content before merging. - Merging a pull request into `main`, or pushing any commit to the `main` branch, will trigger an automatic build of the production site at [srccon.org](https://srccon.org) via GitHub Actions. - The production site is delivered through Amazon CloudFront so that we can serve a secure, https-enabled [srccon.org](https://srccon.org). CloudFront also caches everything for performance. The rebuild process triggers an invalidation of the entire cache, but it still may take up to 10 minutes for site changes to be reflected on production. +- **View deployment status:** Check the repository's [Deployments](../../deployments) tab to see the deployment history and status. ### GitHub Actions Workflows @@ -130,9 +134,10 @@ The repository includes GitHub Actions workflows in `.github/workflows/`: 1. **Deploy Workflow** (`deploy.yml`) - Triggers on push to `main` or `staging` branches - Builds Jekyll site with Ruby 3.2 + - Creates GitHub Deployment events for tracking - Deploys to S3 using AWS CLI with OIDC authentication - Invalidates CloudFront cache (production only) - - Sends Slack notifications on completion + - Updates deployment status (success/failure) in GitHub Deployments tab 2. **Test Workflow** (`test.yml`) - Runs on all PRs and non-deployment branches From ecfaf0ec34a9388e4951b4cc4ebf04e995394e26 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 20:47:27 +0000 Subject: [PATCH 3/5] Fix environment URLs in deployment status updates Co-authored-by: tiffehr <60173+tiffehr@users.noreply.github.com> --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 80114ce2..7c5f318b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -122,7 +122,7 @@ jobs: repo: context.repo.repo, deployment_id: ${{ steps.deployment-staging.outputs.result }}, state: 'success', - environment_url: 'http://${{ steps.config.outputs.staging_bucket }}', + environment_url: 'http://${{ steps.config.outputs.staging_bucket }}.s3-website-us-east-1.amazonaws.com', description: 'Staging deployment completed successfully' }); @@ -136,7 +136,7 @@ jobs: repo: context.repo.repo, deployment_id: ${{ steps.deployment-production.outputs.result }}, state: 'success', - environment_url: 'https://${{ steps.config.outputs.bucket }}', + environment_url: 'https://srccon.org', description: 'Production deployment completed successfully' }); From 71168aa8ef2ac1fd9180b622e91ab1ab971ffc85 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 20:48:21 +0000 Subject: [PATCH 4/5] Add deployment ID existence check before updating failure status Co-authored-by: tiffehr <60173+tiffehr@users.noreply.github.com> --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7c5f318b..712e644e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -141,7 +141,7 @@ jobs: }); - name: Update Deployment Status (Staging Failure) - if: github.ref == 'refs/heads/staging' && failure() + if: github.ref == 'refs/heads/staging' && failure() && steps.deployment-staging.outputs.result uses: actions/github-script@v7 with: script: | @@ -154,7 +154,7 @@ jobs: }); - name: Update Deployment Status (Production Failure) - if: github.ref == 'refs/heads/main' && failure() + if: github.ref == 'refs/heads/main' && failure() && steps.deployment-production.outputs.result uses: actions/github-script@v7 with: script: | From 8e0f17b352b49da5e51023a71b3630f4a421ed36 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Mar 2026 03:28:18 +0000 Subject: [PATCH 5/5] Fix step ID references and deployment links - Change step IDs from deployment-staging/deployment-production to deployment_staging/deployment_production (underscores instead of hyphens) - Update all references to use the new step IDs with dot notation - Fix README deployment links from relative (../../deployments) to absolute (https://github.com/OpenNews/srccon/deployments) Co-authored-by: tiffehr <60173+tiffehr@users.noreply.github.com> --- .github/workflows/deploy.yml | 16 ++++++++-------- README.md | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 712e644e..17b87aa3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -59,7 +59,7 @@ jobs: - name: Create GitHub Deployment (Staging) if: github.ref == 'refs/heads/staging' - id: deployment-staging + id: deployment_staging uses: actions/github-script@v7 with: script: | @@ -76,7 +76,7 @@ jobs: - name: Create GitHub Deployment (Production) if: github.ref == 'refs/heads/main' - id: deployment-production + id: deployment_production uses: actions/github-script@v7 with: script: | @@ -120,7 +120,7 @@ jobs: await github.rest.repos.createDeploymentStatus({ owner: context.repo.owner, repo: context.repo.repo, - deployment_id: ${{ steps.deployment-staging.outputs.result }}, + deployment_id: ${{ steps.deployment_staging.outputs.result }}, state: 'success', environment_url: 'http://${{ steps.config.outputs.staging_bucket }}.s3-website-us-east-1.amazonaws.com', description: 'Staging deployment completed successfully' @@ -134,34 +134,34 @@ jobs: await github.rest.repos.createDeploymentStatus({ owner: context.repo.owner, repo: context.repo.repo, - deployment_id: ${{ steps.deployment-production.outputs.result }}, + deployment_id: ${{ steps.deployment_production.outputs.result }}, state: 'success', environment_url: 'https://srccon.org', description: 'Production deployment completed successfully' }); - name: Update Deployment Status (Staging Failure) - if: github.ref == 'refs/heads/staging' && failure() && steps.deployment-staging.outputs.result + if: github.ref == 'refs/heads/staging' && failure() && steps.deployment_staging.outputs.result uses: actions/github-script@v7 with: script: | await github.rest.repos.createDeploymentStatus({ owner: context.repo.owner, repo: context.repo.repo, - deployment_id: ${{ steps.deployment-staging.outputs.result }}, + deployment_id: ${{ steps.deployment_staging.outputs.result }}, state: 'failure', description: 'Staging deployment failed' }); - name: Update Deployment Status (Production Failure) - if: github.ref == 'refs/heads/main' && failure() && steps.deployment-production.outputs.result + if: github.ref == 'refs/heads/main' && failure() && steps.deployment_production.outputs.result uses: actions/github-script@v7 with: script: | await github.rest.repos.createDeploymentStatus({ owner: context.repo.owner, repo: context.repo.repo, - deployment_id: ${{ steps.deployment-production.outputs.result }}, + deployment_id: ${{ steps.deployment_production.outputs.result }}, state: 'failure', description: 'Production deployment failed' }); diff --git a/README.md b/README.md index a6f71aa3..f872dce8 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ All deployments are tracked in GitHub's **Deployments** tab, making it easy to s - When you're ready to have someone review a site update, update the `staging` branch in GitHub. If you're working in `staging` locally, you just need to push your code changes. If you're working in a separate feature branch, push that branch to GitHub and then open a pull request into `staging` and merge it. - A commit to the `staging` branch on GitHub will trigger an automatic build of the SRCCON staging site via GitHub Actions. - The GitHub Actions workflow can take a minute or two to complete. Your changes will not be visible on the staging site immediately, but they'll be there quickly. -- **View deployment status:** Check the repository's [Deployments](../../deployments) tab to see the deployment history and status. +- **View deployment status:** Check the repository's [Deployments](https://github.com/OpenNews/srccon/deployments) tab to see the deployment history and status. ### Pushing to production @@ -125,7 +125,7 @@ All deployments are tracked in GitHub's **Deployments** tab, making it easy to s - **Optional QA step:** Run `bundle exec rake review:compare_deployed_sites` to see a detailed comparison of staging vs production content before merging. - Merging a pull request into `main`, or pushing any commit to the `main` branch, will trigger an automatic build of the production site at [srccon.org](https://srccon.org) via GitHub Actions. - The production site is delivered through Amazon CloudFront so that we can serve a secure, https-enabled [srccon.org](https://srccon.org). CloudFront also caches everything for performance. The rebuild process triggers an invalidation of the entire cache, but it still may take up to 10 minutes for site changes to be reflected on production. -- **View deployment status:** Check the repository's [Deployments](../../deployments) tab to see the deployment history and status. +- **View deployment status:** Check the repository's [Deployments](https://github.com/OpenNews/srccon/deployments) tab to see the deployment history and status. ### GitHub Actions Workflows