-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
92 additions
and
0 deletions.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| name: Deploy EOEFANS API to Azure | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "release" ] | ||
| 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 | ||
| 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 }} | ||
|
|
||
|
|
||
| - 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 | ||
| } | ||
| ] | ||
| - 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 | ||
|
|
||
| # For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples |