deploy prod with azure #7
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: Develop CD workflow | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- develop | |
env: | |
IMAGE_NAME: ghcr.io/lemoncode/code-paster:dev-${{github.sha}}-${{github.run_attempt}} | |
permissions: | |
contents: 'read' | |
packages: 'write' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: 'Development' | |
url: https://dev-codepaster.azurewebsites.net | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to GitHub container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push docker image | |
run: | | |
docker build \ | |
--build-arg BASE_API_URL=https://dev-codepaster.azurewebsites.net \ | |
--build-arg BASE_SOCKET_URL=https://dev-codepaster.azurewebsites.net \ | |
-t ${{env.IMAGE_NAME}} . | |
docker push ${{env.IMAGE_NAME}} | |
- name: Deploy to Azure | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: ${{ secrets.DEV_AZURE_APP_NAME }} | |
publish-profile: ${{ secrets.DEV_AZURE_PUBLISH_PROFILE }} | |
images: ${{env.IMAGE_NAME}} |