Deploy EOEFANS API to Azure: version v1.0.40 #42
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: Deploy EOEFANS API to Azure | |
on: | |
# push: | |
# branches: [ "release" ] | |
# pull_request: | |
# types: [synchronize, closed] | |
# branches: [ "release" ] | |
workflow_dispatch: | |
inputs: | |
deploy_version: | |
required: true | |
type: string | |
sentry_release: | |
required: true | |
type: string | |
run-name: "Deploy EOEFANS API to Azure: version ${{ inputs.deploy_version }}" | |
env: | |
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} | |
AZURE_WEBAPP_NAME: "eoefans-api-01" # set this to your application's name | |
AZURE_PUBLISH_PROFILE: ${{ secrets.AZURE_CREDENTIALS_EOEFANS_API }} | |
IMAGE_REGISTRY: "containers.vlink.dev" | |
IMAGE_REPO: "eoefans" | |
IMAGE_NAME: "eoefans-api" | |
DEPLOY_VERSION: ${{ inputs.deploy_version }} | |
SENTRY_RELEASE: ${{ inputs.sentry_release }} | |
SENTRY_ORG: "eoefans" | |
SENTRY_PROJECT: "eoefans-api" | |
permissions: | |
contents: read | |
packages: read | |
jobs: | |
Deploy: | |
permissions: | |
contents: none | |
runs-on: [self-hosted, Linux] | |
environment: | |
name: 'Production-API' | |
# url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: install azure cli | |
run: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash | |
- run: az --version | |
- name: Log in to VLINK Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.IMAGE_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: azure/login@v1 | |
with: | |
creds: '${{ env.AZURE_CREDENTIALS }}' | |
- name: Set Web App configuration | |
uses: Azure/appservice-settings@v1 | |
with: | |
app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
app-settings-json: | | |
[ | |
{ | |
"name": "DOCKER_REGISTRY_SERVER_PASSWORD", | |
"value": "${{ secrets.CONTAINER_DEPLOY_PASSWORD }}", | |
"slotSetting": false | |
}, | |
{ | |
"name": "DOCKER_REGISTRY_SERVER_URL", | |
"value": "https://${{ env.IMAGE_REGISTRY }}", | |
"slotSetting": false | |
}, | |
{ | |
"name": "DOCKER_REGISTRY_SERVER_USERNAME", | |
"value": "${{ secrets.CONTAINER_DEPLOY_USERNAME }}", | |
"slotSetting": false | |
}, | |
{ | |
"name": "SENTRY_RELEASE", | |
"value": "${{ env.DEPLOY_VERSION }}", | |
"slotSetting": false | |
}, | |
{ | |
"name": "SENTRY_ENV", | |
"value": "production", | |
"slotSetting": false | |
}, | |
{ | |
"name": "VERSION", | |
"value": "${{ env.DEPLOY_VERSION }}", | |
"slotSetting": false | |
} | |
] | |
- name: Deploy to Azure Web App | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
publish-profile: ${{ env.AZURE_PUBLISH_PROFILE }} | |
images: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:${{ env.DEPLOY_VERSION }} | |
- name: Create Sentry release | |
if: ${{ (env.SENTRY_RELEASE == 'true') || (env.SENTRY_RELEASE == 'True') || (env.SENTRY_RELEASE == '1') }} | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ env.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ env.SENTRY_PROJECT }} | |
SENTRY_URL: ${{ secrets.SENTRY_URL }} | |
with: | |
environment: production | |
version: ${{ env.DEPLOY_VERSION }} |