Merge pull request #165 from Lemoncode/develop #4
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: Production CD workflow | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
env: | |
IMAGE_NAME: ghcr.io/lemoncode/code-paster:prod-${{github.sha}}-${{github.run_attempt}} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: "Production" | |
url: https://codepaster.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://codepaster.net \ | |
--build-arg BASE_SOCKET_URL=https://codepaster.net \ | |
-t ${{env.IMAGE_NAME}} . | |
docker push ${{env.IMAGE_NAME}} | |
- name: Deploy to Azure | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: ${{ secrets.PROD_AZURE_APP_NAME }} | |
publish-profile: ${{ secrets.PROD_AZURE_PUBLISH_PROFILE }} | |
images: ${{env.IMAGE_NAME}} |