.pre-commit.yaml - managed by sudoblark.terraform.github #29
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
name: Publish OpenAPI to S3 on merge to main | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.SUDOBLARK_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.SUDOBLARK_AWS_ACCESS_KEY_VALUE }} | |
AWS_DEFAULT_REGION: eu-west-2 | |
MONSTERNAMES_OPENAPI_STATIC_CONTENT_BUCKET: sudoblark-prod-monsternames-static-content | |
ENVIRONMENT: Prod | |
# Automatically generated token unique to this repo per workflow execution | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '.github/**' | |
- 'LICENSE.txt' | |
permissions: | |
contents: read | |
deployments: write | |
jobs: | |
deploy: | |
name: Deploy SwaggerUI | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Delete GitHub deployments | |
uses: strumwolf/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment: ${{ env.ENVIRONMENT }} | |
onlyRemoveDeployments: true | |
- name: Create GitHub deployment | |
uses: chrnorm/deployment-action@releases/v1 | |
id: deployment | |
with: | |
token: ${{ secrets.GITHUB_TOKEN}} | |
description: 'monsternames OpenAPI SwaggerUI' | |
environment: ${{ env.ENVIRONMENT }} | |
- name: Sync artefact to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
# As per https://github.com/jakejarvis/s3-sync-action/issues/26 | |
args: --follow-symlinks --delete --exclude '*' --include 'index.html' | |
env: | |
AWS_S3_BUCKET: ${{ env.MONSTERNAMES_OPENAPI_STATIC_CONTENT_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ env.AWS_DEFAULT_REGION }} | |
- name: Update deployment status (success) | |
if: success() | |
uses: chrnorm/deployment-status@releases/v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
target_url: https://monsternames.sudoblark.com | |
state: 'success' | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | |
- name: Update deployment status (failed) | |
if: failure() | |
uses: chrnorm/deployment-status@releases/v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
target_url: https://monsternames.sudoblark.com | |
state: 'failure' | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} |