Skip to content

Commit

Permalink
ci: update Deploy workflow to tag-based
Browse files Browse the repository at this point in the history
  • Loading branch information
lalver1 committed Jul 12, 2024
1 parent 4eb2a50 commit d48ebce
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@ 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]+"

defaults:
run:
shell: bash

concurrency:
# 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)
group: ${{ github.ref_type != 'tag' && github.ref_name || contains(github.ref, '-rc') && 'test' || 'prod' }}
cancel-in-progress: true

jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}
concurrency: ${{ github.ref_name }}
environment: ${{ github.ref_type != 'tag' && github.ref_name || contains(github.ref, '-rc') && 'test' || 'prod' }}

steps:
- name: Checkout
Expand Down Expand Up @@ -69,3 +76,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: ${{ (github.ref_type != 'tag' && github.ref_name || contains(github.ref, '-rc') && 'test' || 'prod') == "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

0 comments on commit d48ebce

Please sign in to comment.