madsenandreas Committed code for azure blob storage #202
Workflow file for this run
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: CICD Frontend Dev | |
run-name: ${{ github.actor }} Committed code for azure blob storage | |
on: | |
push: | |
branches: | |
- dev | |
workflow_dispatch: | |
env: | |
ACCOUNT_NAME: udirdit | |
SOURCE: dist | |
DESTINATION: frontend-dev | |
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: yarn install | |
- name: Run build script | |
run: yarn buildDev | |
- name: Login to Azure | |
uses: azure/login@v2 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Upload files to Azure Blob | |
uses: azure/CLI@v2 | |
with: | |
azcliversion: 2.34.1 | |
inlineScript: | | |
az storage blob upload-batch --account-name ${{ env.ACCOUNT_NAME }} \ | |
--auth-mode key -s ${{ env.SOURCE }} -d ${{ env.DESTINATION }} --overwrite | |
az storage blob list --account-name ${{ env.ACCOUNT_NAME }} --container-name ${{ env.DESTINATION }} --query "[?ends_with(name, '.woff')].{Name:name}" --output tsv | \ | |
xargs -I {} az storage blob update --account-name ${{ env.ACCOUNT_NAME }} --container-name ${{ env.DESTINATION }} --name {} --content-type "application/font-woff" | |
az storage blob list --account-name ${{ env.ACCOUNT_NAME }} --container-name ${{ env.DESTINATION }} --query "[?ends_with(name, '.woff2')].{Name:name}" --output tsv | \ | |
xargs -I {} az storage blob update --account-name ${{ env.ACCOUNT_NAME }} --container-name ${{ env.DESTINATION }} --name {} --content-type "font/woff2" | |
# Azure logout - Force step to always run with 'always()', ensures no hanging logins | |
- name: logout | |
if: always() | |
run: | | |
az logout |