Skip to content

Commit

Permalink
Merge pull request #32 from microsoft/user/cajok/storage-managed-iden…
Browse files Browse the repository at this point in the history
…tity

Switch to managed identity for storage upload
  • Loading branch information
JudahGabriel authored Jul 31, 2024
2 parents 6268102 + a1fee8c commit 3f678bc
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/deploy-badge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ on:
push:
branches:
- main
permissions:
id-token: write
contents: read

jobs:
jobs:
build_and_deploy_job:
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed'))
runs-on: ubuntu-latest
Expand All @@ -32,34 +35,40 @@ jobs:
api_location: "" # Api source code path - optional
output_location: "/dist" # Built app content directory - optional
###### End of Repository/Build Configurations ######

deploy_bundle:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build_and_deploy_job
name: Upload Bundle to Blob Storage
steps:
- uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- uses: actions/checkout@v2
- uses: LanceMcCarthy/Action-AzureBlobUpload@v1.9.0
- uses: azure/CLI@v1
with:
connection_string: ${{ secrets.AZURE_BLOB_STORAGE_CONNECTION_STRING }}
container_name: $web
source_folder: /home/runner/work/app-store-badge/app-store-badge/dist/ms-store-badge.bundled.js
inlineScript: |
az storage blob upload --account-name ${{ secrets.AZURE_BLOB_STORAGE_NAME }} -c '$web' -f /home/runner/work/app-store-badge/app-store-badge/dist/ms-store-badge.bundled.js --auth-mode login
deploy_images:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build_and_deploy_job
name: Upload Images to Blob Storage
steps:
- uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- uses: actions/checkout@v2
- uses: LanceMcCarthy/Action-AzureBlobUpload@v1.9.0
- uses: azure/CLI@v1
with:
connection_string: ${{ secrets.AZURE_BLOB_STORAGE_CONNECTION_STRING }}
container_name: $web
source_folder: /home/runner/work/app-store-badge/app-store-badge/dist/images
destination_folder: /images

inlineScript: |
az storage blob upload-batch --account-name ${{ secrets.AZURE_BLOB_STORAGE_NAME }} -d $web --destination-path /images -s /home/runner/work/app-store-badge/app-store-badge/dist/images --auth-mode login
close_pull_request_job:
if: github.ref == 'refs/heads/main' && (github.event_name == 'pull_request' && github.event.action == 'closed')
Expand Down

0 comments on commit 3f678bc

Please sign in to comment.