-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/design
- Loading branch information
Showing
2 changed files
with
77 additions
and
4 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,42 @@ | ||
name: Delete Dev Version | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
delete: | ||
permissions: | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: GitHub Slug Action | ||
uses: rlespinasse/github-slug-action@v4 | ||
- name: Generate SLS Stage | ||
id: generate_sls_stage | ||
uses: actions/github-script@v6 | ||
with: | ||
result-encoding: string | ||
script: | | ||
if (context.payload.ref == 'refs/heads/master') { | ||
return 'prod'; | ||
} | ||
return process.env.GITHUB_REF_NAME_SLUG_URL; | ||
- name: Remove Dev Version | ||
env: | ||
STACK_NAME: HordeNG-${{ env.GITHUB_REF_NAME_SLUG_URL }} | ||
AWS_REGION: eu-central-1 | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
run: | | ||
export BUCKET_NAME=$(aws cloudformation describe-stacks --stack-name $STACK_NAME --query "Stacks[0].Outputs[?OutputKey=='Bucket'].OutputValue" --output=text) | ||
export DEPLOYMENT_BUCKET_NAME=$(aws cloudformation describe-stacks --stack-name $STACK_NAME --query "Stacks[0].Outputs[?OutputKey=='ServerlessDeploymentBucketName'].OutputValue" --output=text) | ||
aws s3 rm s3://$BUCKET_NAME --recursive | ||
aws s3 rm s3://$DEPLOYMENT_BUCKET_NAME --recursive | ||
aws cloudformation delete-stack --stack-name $STACK_NAME | ||
- name: Post Link | ||
uses: thollander/actions-comment-pull-request@v2 | ||
with: | ||
message: The preview URL for this PR was deleted when the PR got closed. | ||
comment_tag: post_link_comment |
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