Skip to content

ci(deploy): skip deploy when App Service secrets are empty; remove re… #22

ci(deploy): skip deploy when App Service secrets are empty; remove re…

ci(deploy): skip deploy when App Service secrets are empty; remove re… #22

Workflow file for this run

name: Build and deploy containers to Azure

Check failure on line 1 in .github/workflows/docker-deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/docker-deploy.yml

Invalid workflow file

(Line: 51, Col: 9): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.EDITOR_APP_NAME != '' && secrets.RESOURCE_GROUP != '' && secrets.EDITOR_API_APP_NAME != ''
on:
push:
branches: [ main ]
jobs:
build-and-push:
runs-on: ubuntu-latest
env:
REGISTRY: tpsappscriptingacr.azurecr.io
steps:
- uses: actions/checkout@v4
- name: Assert required ACR secrets are set
run: |
if [ -z "${{ secrets.ACR_USERNAME }}" ]; then echo "ERROR: secrets.ACR_USERNAME is not set"; exit 1; fi
if [ -z "${{ secrets.ACR_PASSWORD }}" ]; then echo "ERROR: secrets.ACR_PASSWORD is not set"; exit 1; fi
- name: Determine registry to use
id: registry
run: |
if [ -n "${{ secrets.ACR_LOGIN_SERVER }}" ]; then echo "registry=${{ secrets.ACR_LOGIN_SERVER }}" >> $GITHUB_OUTPUT; else echo "registry=${{ env.REGISTRY }}" >> $GITHUB_OUTPUT; fi
- name: Log in to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ steps.registry.outputs.registry }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build and push editor image
run: |
docker build \
--build-arg VITE_APP_BUILD_TIME=${{ github.event.head_commit.timestamp }} \
--build-arg VITE_APP_COMMIT_SHA=${{ github.sha }} \
--build-arg VITE_APP_VERSION=1.0.0 \
-t ${{ steps.registry.outputs.registry }}/app-scripting-editor:latest .
docker push ${{ steps.registry.outputs.registry }}/app-scripting-editor:latest
- name: Build and push editor-api image
run: |
docker build \
--build-arg VITE_APP_BUILD_TIME=${{ github.event.head_commit.timestamp }} \
--build-arg VITE_APP_COMMIT_SHA=${{ github.sha }} \
--build-arg VITE_APP_VERSION=1.0.0 \
-t ${{ steps.registry.outputs.registry }}/app-scripting-editor-api:latest ./server
docker push ${{ steps.registry.outputs.registry }}/app-scripting-editor-api:latest
deploy-to-appservice:
if: ${{ secrets.EDITOR_APP_NAME != '' && secrets.RESOURCE_GROUP != '' && secrets.EDITOR_API_APP_NAME != '' }}
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy editor to App Service (container)
run: |
az webapp config container set --name ${{ secrets.EDITOR_APP_NAME }} --resource-group ${{ secrets.RESOURCE_GROUP }} --docker-custom-image-name ${{ steps.registry.outputs.registry }}/app-scripting-editor:latest
- name: Deploy editor-api to App Service (container)
run: |
az webapp config container set --name ${{ secrets.EDITOR_API_APP_NAME }} --resource-group ${{ secrets.RESOURCE_GROUP }} --docker-custom-image-name ${{ steps.registry.outputs.registry }}/app-scripting-editor-api:latest