Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Add manual rollback action
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend committed Jul 11, 2022
1 parent c682047 commit 0cd5b3f
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/rollback_production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Rollback Frontend

on:
pull_request:
workflow_dispatch:
inputs:
environment:
description: The environment to roll back.
default: "staging"
tag:
# required: true # uncomment after testing
description: The GHCR image tag to which production should be rolled back
default: "asdf"

jobs:
rollback:
name: Perform Rollback
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Validate `tag` input
uses: actions/github-script@v6
with:
script: |
const versions = await github.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({
package_type: 'container',
package_name: 'openverse-frontend',
org: 'WordPress',
})
conosle.log(versions)
const exists = versions.some(v => v.name === "${{ inputs.tag }}")
if (!exists) {
throw new Error("`${{ inputs.tag }}` does not appear to be a valid tag for the ghcr.io/wordpress/openverse-frontend image.")
}
- uses: ./github/actions/production-frontend-deploy
if: inputs.environment == 'production'
with:
ref: ${{ inputs.tag }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK_URL }}

- uses: ./github/actions/staging-frontend-deploy
if: inputs.environment == 'staging'
with:
ref: ${{ inputs.tag }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK_URL }}

0 comments on commit 0cd5b3f

Please sign in to comment.