This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c682047
commit 0cd5b3f
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |