-
Notifications
You must be signed in to change notification settings - Fork 547
53 lines (52 loc) · 2.2 KB
/
Copy pathgrandnode.yml
File metadata and controls
53 lines (52 loc) · 2.2 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
name: Build and deploy .NET Core app to Linux WebApp grandnode
on:
push:
branches: [ "develop" ]
env:
AZURE_WEBAPP_NAME: grandnode-dev
AZURE_WEBAPP_PACKAGE_PATH: src/Web/Grand.Web/publish
AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
CONFIGURATION: Release
WORKING_DIRECTORY: src/Web/Grand.Web
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.301
- name: Create mongoDB Docker container
run: sudo docker run -d -p 27017:27017 mongo:latest
- name: Wait for MongoDB to be ready
run: |
for i in {1..30}; do
nc -z localhost 27017 && echo "MongoDB is up" && exit 0
sleep 2
done
echo "MongoDB did not become ready" && exit 1
- name: Restore
run: dotnet restore "${{ env.WORKING_DIRECTORY }}"
- name: Build sln
run: dotnet build "GrandNode.sln" --configuration ${{ env.CONFIGURATION }}
- name: Unit tests
# The job-level CONFIGURATION env var is picked up by MSBuild as the Configuration
# property, so "Build sln" above produces Release regardless of the missing
# --configuration flag. The tests must look in the same place.
run: ./.github/scripts/run-tests.sh ${{ env.CONFIGURATION }}
- name: Build
run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore -p:SourceRevisionId=${{ github.sha }} -p:GitBranch=${{ github.ref_name }}
- name: Publish
run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}" -p:SourceRevisionId=${{ github.sha }} -p:GitBranch=${{ github.ref_name }}
- name: Deploy to Azure WebApp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
publish-profile: ${{ env.AZURE_WEBAPP_PUBLISH_PROFILE }}
- name: Publish Artifacts
uses: actions/upload-artifact@v4.0.0
with:
name: webapp
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}