dotnet-podcasts/.github/workflows/podcast-hub.yml

63 lines
1.5 KiB
YAML
Raw Normal View History

2021-11-30 03:54:48 +08:00
name: Podcast Hub CICD
on:
push:
2022-12-07 22:28:10 +08:00
branches: [main]
2021-11-30 03:54:48 +08:00
paths:
2022-12-07 22:28:10 +08:00
- "src/Services/ListenTogether/**"
- "deploy/Services/hub.bicep"
- ".github/workflows/podcast-hub.yml"
2021-11-30 03:54:48 +08:00
pull_request:
2022-12-07 22:28:10 +08:00
branches: [main]
2021-11-30 03:54:48 +08:00
paths:
2022-12-07 22:28:10 +08:00
- "src/Services/ListenTogether/**"
- ".github/workflows/podcast-hub.yml"
2021-11-30 03:54:48 +08:00
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
2022-12-07 22:28:10 +08:00
2021-11-30 03:54:48 +08:00
- name: Set up .NET Core
uses: actions/setup-dotnet@v3
2021-11-30 03:54:48 +08:00
with:
2022-12-07 22:28:10 +08:00
dotnet-version: "7.0.x"
2021-11-30 03:54:48 +08:00
- name: Build
run: dotnet build --configuration Release src/Services/ListenTogether/ListenTogether.Hub
- name: Publish
run: dotnet publish --configuration Release src/Services/ListenTogether/ListenTogether.Hub --output hub
2022-12-05 23:42:44 +08:00
- uses: actions/upload-artifact@v3
2021-11-30 03:54:48 +08:00
with:
name: drop
path: hub
deployStaging:
2022-12-07 22:28:10 +08:00
name: "Deploy PR to Staging environment"
2021-11-30 03:54:48 +08:00
needs: build
2022-12-07 22:28:10 +08:00
if: "!contains(github.ref, 'refs/heads/main')"
2022-12-05 23:37:56 +08:00
uses: ./.github/workflows/template-hub.yml
2022-12-06 00:51:54 +08:00
concurrency:
2022-12-06 00:56:29 +08:00
group: staging-hub
2022-12-07 22:28:10 +08:00
cancel-in-progress: true
2022-12-05 23:37:56 +08:00
secrets: inherit
with:
environment: staging
2021-11-30 03:54:48 +08:00
deployProd:
2022-12-07 22:28:10 +08:00
name: "Deploy main branch commit to Production environment"
needs: build
2022-12-05 04:34:01 +08:00
if: contains(github.ref, 'refs/heads/main')
2022-12-05 23:37:56 +08:00
uses: ./.github/workflows/template-hub.yml
2022-12-06 00:51:54 +08:00
concurrency:
2022-12-06 00:56:29 +08:00
group: prod-hub
2022-12-07 22:28:10 +08:00
cancel-in-progress: true
2022-12-05 23:37:56 +08:00
secrets: inherit
with:
2022-12-07 22:28:10 +08:00
environment: prod