From 3f096d7b521de3848ded773e2b04515c5e0b8e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Kazami=20=5B=E4=B9=94=E6=B2=BB=C2=B7=E9=A2=A8?= =?UTF-8?q?=E8=A6=8B=5D?= Date: Sat, 11 Feb 2023 20:45:34 +0000 Subject: [PATCH] Update eoefans-api-azure-deploy.yml --- .../workflows/eoefans-api-azure-deploy.yml | 104 +++++------------- 1 file changed, 28 insertions(+), 76 deletions(-) diff --git a/.github/workflows/eoefans-api-azure-deploy.yml b/.github/workflows/eoefans-api-azure-deploy.yml index 321f3ce..95f0b9e 100644 --- a/.github/workflows/eoefans-api-azure-deploy.yml +++ b/.github/workflows/eoefans-api-azure-deploy.yml @@ -6,87 +6,39 @@ on: pull_request: types: [synchronize, closed] branches: [ "release" ] - -# CONFIGURATION -# For help, go to https://github.com/Azure/Actions -# -# Set up the following secrets in your repository: -# AZURE_CREDENTIALS, REGISTRY_USERNAME, REGISTRY_PASSWORD, REGISTRY_URL -# 2. Change these variables for your configuration: + env: - AZURE_WEBAPP_NAME: eoefans-api # set this to your application's name - CONTAINER_REGISTRY: containers.vlink.dev # set secret with Container Registry URL, example : xyz.azurecr.io - IMAGE_REGISTRY: containers.vlink.dev -# AZURE_RESOURCE_GROUP: ActionsDemo # set this to your Azure Resource group's name - Needed only if you are provisioning the app in the workflow -# AZURE_APP_PLAN: ActionPlan # set this to your App service plan's name - Needed only if you are provisioning the app in the workflow + AZURE_WEBAPP_NAME: "eoefans-api" # set this to your application's name + IMAGE_REGISTRY: "containers.vlink.dev" IMAGE_REPO: "eoefans" IMAGE_NAME: "eoefans-api" -jobs: - Deploy-to-Azure: - runs-on: [ self-hosted, Linux ] - steps: - - uses: actions/checkout@v3 - - - name: Azure authentication - uses: azure/login@v1 - with: - creds: ${{ secrets.AZURE_CREDENTIALS_EOEFANS_API }} - -# - name: Azure CLI script to provision a new Web App for Container -# uses: azure/CLI@v0-beta -# with: -# azcliversion: latest -# inlineScript: | -# az webapp create --resource-group ${{ env.AZURE_RESOURCE_GROUP }} --plan ${{ env.AZURE_APP_PLAN }} --name ${{ env.AZURE_WEBAPP_NAME }} -i nginx -# - name: ACR authentication -# uses: azure/docker-login@v1 -# with: -# login-server: ${{ env.CONTAINER_REGISTRY }} -# username: ${{ secrets.REGISTRY_USERNAME }} -# password: ${{ secrets.REGISTRY_PASSWORD }} -# - name: Docker Build & Push to ACR -# run: | -# docker build . -t ${{ env.CONTAINER_REGISTRY }}/nodejsapp:${{ github.sha }} -# docker push ${{ env.CONTAINER_REGISTRY }}/nodejsapp:${{ github.sha }} +jobs: - - name: Log in to VLINK Container Registry - uses: docker/login-action@v2 - with: - registry: ${{ env.IMAGE_REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - -# Uncomment the below action snippet if the Web app credentials are not updated as web app settings - - name: Set Web App ACR authentication - uses: Azure/appservice-settings@v1 - with: - app-name: ${{ env.AZURE_WEBAPP_NAME }} - app-settings-json: | - [ - { - "name": "DOCKER_REGISTRY_SERVER_PASSWORD", - "value": "${{ secrets.GITHUB_TOKEN }}", - "slotSetting": false - }, - { - "name": "DOCKER_REGISTRY_SERVER_URL", - "value": "https://${{ env.CONTAINER_REGISTRY }}", - "slotSetting": false - }, - { - "name": "DOCKER_REGISTRY_SERVER_USERNAME", - "value": "${{ github.actor }}", - "slotSetting": false - } - ] + Deploy: + permissions: + contents: none + + runs-on: [self-hosted, Linux] + environment: + name: 'Development' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} - - name: 'Deploy to Azure Web App for Container' - uses: azure/webapps-deploy@v2 - with: - app-name: ${{ env.AZURE_WEBAPP_NAME }} - images: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:latest -# startup-command: 'npm start' # Include start up command to start the app container + steps: + - uses: actions/checkout@v3 + + - name: Log in to VLINK Container Registry + uses: docker/login-action@v2 + with: + registry: ${{ env.IMAGE_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} -# For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: ${{ env.AZURE_WEBAPP_NAME }} + publish-profile: ${{ secrets.AZURE_CREDENTIALS_EOEFANS_API }} + images: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:latest