-
Notifications
You must be signed in to change notification settings - Fork 16
122 lines (106 loc) · 4.09 KB
/
Copy pathbuild-nightly_12.3.yml
File metadata and controls
122 lines (106 loc) · 4.09 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Build Nightly 12.3
run-name: Version 12.3.${{ github.run_number }}
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
permissions:
contents: read
packages: read
jobs:
get-latest-commit-timespan:
runs-on: ubuntu-latest
outputs:
LATEST_COMMIT_TIMESPAN: ${{ steps.get-latest-commit-timespan.outputs.LATEST_COMMIT_TIMESPAN}}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get the previous commit timespan
id: get-latest-commit-timespan
shell: bash
run: |
commit=$(git log origin/develop -1 --format="%at")
echo $commit
now=$(date +%s)
echo $now
timespan=$[now - commit]
echo "Timespan: ${timespan}"
echo "LATEST_COMMIT_TIMESPAN=${timespan}" >> $GITHUB_ENV
echo "LATEST_COMMIT_TIMESPAN=${timespan}" >> $GITHUB_OUTPUT
build-nightly:
needs: get-latest-commit-timespan
if: needs.get-latest-commit-timespan.outputs.LATEST_COMMIT_TIMESPAN < 86400
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Restore dependencies
run: |
nuget sources add -username Open-Systems-Pharmacology -password ${{ secrets.GITHUB_TOKEN }} -name OSP-GitHub-Packages -source "https://nuget.pkg.github.com/Open-Systems-Pharmacology/index.json"
dotnet restore
- name: define env variables
run: |
echo "APP_VERSION=12.3.${{ github.run_number }}" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Build
run: |
rake "update_go_license[ApplicationStartup.cs, ${{ secrets.GO_DIAGRAM_KEY }}]"
dotnet build /p:Version=${{env.APP_VERSION}}
- name : Test
run: dotnet test -v normal --no-build --logger:"html;LogFileName=../testLog_Windows.html"
- name: Sign MoBi.exe with CodeSignTool
uses: Open-Systems-Pharmacology/Workflows/.github/actions/codesigner-SSL@main
env:
ES_USERNAME: ${{ secrets.ES_USERNAME }}
ES_PASSWORD: ${{ secrets.ES_PASSWORD }}
ES_CREDENTIAL_ID: ${{ secrets.ES_CREDENTIAL_ID }}
ES_TOTP_SECRET: ${{ secrets.ES_TOTP_SECRET }}
with:
file_path: ./src/MoBi/bin/Debug/net472/MoBi.exe
- name: Create Setup
run: |
rake "create_setup[${{env.APP_VERSION}}, Debug]"
rake "create_portable_setup[${{env.APP_VERSION}}, Debug, mobi-portable-setup.zip]"
- name: Sign MoBi setup with CodeSignTool
uses: Open-Systems-Pharmacology/Workflows/.github/actions/codesigner-SSL@main
env:
ES_USERNAME: ${{ secrets.ES_USERNAME }}
ES_PASSWORD: ${{ secrets.ES_PASSWORD }}
ES_CREDENTIAL_ID: ${{ secrets.ES_CREDENTIAL_ID }}
ES_TOTP_SECRET: ${{ secrets.ES_TOTP_SECRET }}
with:
file_path: ./setup/deploy/MoBi.${{ env.APP_VERSION }}.msi
- name: Push test log as artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: testLog_Windows
path: ./testLog*.html
- name: Push nightly installer as artifact
uses: actions/upload-artifact@v4
with:
name: MoBi Installer ${{env.APP_VERSION}}
path: setup\deploy\*.msi
- name: Push nightly portable as artifact
uses: actions/upload-artifact@v4
with:
name: MoBi Portable ${{env.APP_VERSION}}
path: setup\MoBi ${{env.APP_VERSION}}
cleanup-job:
needs: get-latest-commit-timespan
if: needs.get-latest-commit-timespan.outputs.LATEST_COMMIT_TIMESPAN >= 86400
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Cancel workflow run
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"