diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 95775a033..15457c829 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,18 +5,28 @@ on: push: branches: - main - - test - - prod + tags: + # pre-release tag + - "202[3-9].[0-9][0-9].[0-9]+-rc[0-9]+" + # release tags + - "202[3-9].[0-9][0-9].[0-9]+" + +env: + # this ternary operator like expression gives us the name of the deployment environment (see https://docs.github.com/en/actions/learn-github-actions/expressions#example) + DEPLOY_ENV: ${{ github.ref_type != 'tag' && github.ref_name || contains(github.ref, '-rc') && 'test' || 'prod' }} defaults: run: shell: bash +concurrency: + group: ${{ env.DEPLOY_ENV }} + cancel-in-progress: true + jobs: deploy: runs-on: ubuntu-latest - environment: ${{ github.ref_name }} - concurrency: ${{ github.ref_name }} + environment: ${{ env.DEPLOY_ENV }} steps: - name: Checkout @@ -69,3 +79,23 @@ jobs: app-name: ${{ vars.AZURE_WEBAPP_NAME }} images: ghcr.io/${{ github.repository }}:${{ github.sha }} publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} + + release: + needs: deploy + if: ${{ env.DEPLOY_ENV == 'prod'}} + runs-on: ubuntu-latest + permissions: + # https://github.com/softprops/action-gh-release#permissions + contents: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Release + uses: softprops/action-gh-release@v2 + with: + prerelease: false + generate_release_notes: true