Repository navigation
98 lines (87 loc) · 3.13 KB
/
Copy pathdeploy.yml
File metadata and controls
98 lines (87 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Deploy
# Deploys to the staging slot. The swap to production is performed manually
# (see README, section "Deployment").
#
# To add a second environment (e.g. "test"):
# 1. Create the GitHub environment "test" and populate its variables
# 2. Add a federated credential for repo:<org>/<repo>:environment:test
# 3. Add a workflow_dispatch input:
# inputs:
# environment:
# type: environment
# default: prod
# and change environment/concurrency/--environment to
# ${{ inputs.environment || 'prod' }}
#
# No code change is required: the resource name suffix is derived from the
# environment name by TestingGhrepotemplateResourceNameResolver.
on:
workflow_dispatch:
push:
branches: [main]
schedule:
# Weekly maintenance-contract run: surfaces dependency drift,
# expired licenses and breakage in the deployment chain early.
- cron: "0 2 * * 1"
permissions:
id-token: write
contents: read
jobs:
test:
uses: ./.github/workflows/ci.yml
deploy:
needs: test
runs-on: ubuntu-latest
environment: prod
concurrency:
group: deploy-prod
cancel-in-progress: false
defaults:
run:
working-directory: backend
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: 1
steps:
- uses: actions/checkout@v5
- uses: actions/setup-dotnet@v5
with:
global-json-file: backend/global.json
- uses: actions/setup-node@v5
with:
node-version: 24
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('backend/Directory.Packages.props') }}
restore-keys: nuget-${{ runner.os }}-
- name: Install Aspire CLI
run: |
curl -sSL https://aspire.dev/install.sh | bash
echo "$HOME/.aspire/bin" >> "$GITHUB_PATH"
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
- name: aspire deploy
run: >
aspire deploy
--apphost TestingGhrepotemplate.AppHost/TestingGhrepotemplate.AppHost.csproj
--environment prod
--non-interactive
env:
Azure__SubscriptionId: ${{ vars.AZURE_SUBSCRIPTION_ID }}
Azure__Location: ${{ vars.AZURE_LOCATION }}
Azure__ResourceGroup: ${{ vars.AZURE_RESOURCE_GROUP }}
Azure__AllowResourceGroupCreation: 'false'
Parameters__EntraGroupId: ${{ vars.DEVELOPERS_ENTRA_GROUP_ID }}
Parameters__EntraGroupName: ${{ vars.DEVELOPERS_ENTRA_GROUP_NAME }}
Parameters__EfExtensionsLicenseName: ${{ secrets.EF_EXTENSIONS_LICENSE_NAME }}
Parameters__EfExtensionsLicenseKey: ${{ secrets.EF_EXTENSIONS_LICENSE_KEY }}
Parameters__TelerikLicense: ${{ secrets.TELERIK_LICENSE }}
Parameters__FontAwesomeNpmAuthToken: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}