Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
333 stars 57 forks source link

Feature request: Notifications after deployment #418

Open sportelli opened 3 years ago

sportelli commented 3 years ago

Being able to have auto-deployment through Github actions is great for Azure Static WebApps, but in a project lifecycle, projet's team needs to be notified that a deployment occurred and is finished:

I would advise two notifications:

I'm available on Twitter (felixsportelli) if you need any more details or if you need my teams to give you more insights on how they work.

ping @anthonychu

anthonychu commented 3 years ago

@sportelli Currently we add a comment to PRs with the preview URL, like this: https://github.com/anthonychu/20210511-vue-basic/pull/1#issuecomment-842878862

The Static Web Apps GitHub Action outputs the URL of the site (or preview URL if a PR). You can set up your own notifications: https://github.com/anthonychu/20210511-vue-basic/blob/3c773f17894c6142277490b1accbd221bd1b76eb/.github/workflows/azure-static-web-apps-wonderful-wave-0b253da10.yml#L34-L42

By setting up your own GitHub Action to send notifications, you have full control over the notification method, as well as the contents of the notification message and error handling (e.g., what to do when the build has failed). Would these solutions work?

nogic1008 commented 3 years ago

This is a sample to use Environments.

  deploy-swa:
    name: Deploy to Azure Static Web Apps
    runs-on: ubuntu-20.04
    environment:
      name: Staging
      url: ${{ steps.swa-deploy.outputs.static_web_app_url }}

    steps:
      - name: Build and Deploy
        id: swa-deploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          action: upload

Result is here result