diff --git a/.github/workflows/delete-web-preview.yml b/.github/workflows/delete-web-preview.yml new file mode 100644 index 0000000..6ba1a7e --- /dev/null +++ b/.github/workflows/delete-web-preview.yml @@ -0,0 +1,24 @@ +name: Delete Preview Build + +on: + pull_request: + types: [closed] + +permissions: + contents: read + id-token: write + pages: write + pull-requests: write + +jobs: + azure_blob: + runs-on: ubuntu-latest + env: + AZURE_STORAGE_ACCOUNT: measuremaxmature + AZURE_STORAGE_SAS_TOKEN: ${{ secrets.AZURE_SAS_TOKEN }} + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + steps: + - name: Install Azure CLI + run: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + - name: Delete old blobs + run: az storage blob delete-batch -s '$web' --pattern "$BRANCH_NAME/*" diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index e1476d2..a12677f 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -5,6 +5,13 @@ on: branches: [main] pull_request: +# If another web build starts for the same branch, cancel the previous build. This +# protects us from two builds trying to upload at the same time and clobbering each +# other. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + permissions: contents: read pages: write