Skip to content

Commit

Permalink
Update web build
Browse files Browse the repository at this point in the history
1. Add the concurrency directive to hopefully avoid having any parallel
   builds of the same branch, which could lead to two builds uploading
   web files at the same time.
2. Add a delete-web-preview workflow that runs whenever a PR is closed
   to delete the temporary web build for that branch.
  • Loading branch information
mehaase committed Feb 20, 2024
1 parent 162b995 commit 5b2866c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 build trying to upload at the same time and clobbering each
# other.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
id-token: write
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/delete-web-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build Website

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: mappingsexplorer
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/*"

0 comments on commit 5b2866c

Please sign in to comment.