forked from WolvenKit/WolvenKit
-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (106 loc) · 4.31 KB
/
nightly.yml
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
123
name: WolvenKit-Nightly
on:
schedule:
- cron: "0 12 * * *"
workflow_dispatch:
jobs:
check_date:
runs-on: windows-2022
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v2
with:
ref: develop
- name: Get commit
run: |
$commit = git log -1 --format=%H
echo "SHA=$commit" >> $env:GITHUB_ENV
- run: echo ${{ env.SHA }}
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ env.SHA }}) && echo "::set-output name=should_run::false"
nightly-wkit-win:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
runs-on: windows-2022
steps:
# setup
- name: checkout
uses: actions/checkout@v2
with:
ref: develop
- name: Get commit
run: |
$commit = git log -1 --format=%H
echo "SHA=$commit" >> $env:GITHUB_ENV
- run: echo ${{ env.SHA }}
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
# environmental variables
- run: echo "PROJ=./WolvenKit/WolvenKit.csproj" >> $env:GITHUB_ENV
- run: echo "PROJC=./WolvenKit.CLI/WolvenKit.CLI.csproj" >> $env:GITHUB_ENV
- run: echo "OUT=./publish/app/" >> $env:GITHUB_ENV
- run: echo "OUTC=./publish/console/" >> $env:GITHUB_ENV
- run: echo "FINALOUT=./publish" >> $env:GITHUB_ENV
- run: echo "NAME=WolvenKit" >> $env:GITHUB_ENV
- run: echo "REF=${{github.ref}}" >> $env:GITHUB_ENV
- run: echo "MREPO=${{github.repository}}" >> $env:GITHUB_ENV
- name: Get version
uses: naminodarie/get-net-sdk-project-versions-action@v1
id: get-version
with:
proj-path: ${{env.PROJ}}
- name: Get console version
uses: naminodarie/get-net-sdk-project-versions-action@v1
id: get-version-cli
with:
proj-path: ${{env.PROJC}}
- name: Get Date
run: |
$date = Get-Date -Format "yyyy-MM-dd"
echo "ISODATE=$date" >> $env:GITHUB_ENV
- run: echo "VERSION=${{steps.get-version.outputs.assembly-version}}-nightly.${{env.ISODATE}}" >> $env:GITHUB_ENV
- run: echo "VERSIONC=${{steps.get-version-cli.outputs.assembly-version}}-nightly.${{env.ISODATE}}" >> $env:GITHUB_ENV
# Publish app
- run: dotnet publish ${{env.PROJ}} -o ${{env.OUT}} -c Release -p:InformationalVersion="${{env.VERSION}}"
# Publish console
- run: dotnet publish ${{env.PROJC}} -o ${{env.OUTC}} -c Release
- run: echo "PORTABLE=${{env.NAME}}-${{env.VERSION}}.zip" >> $env:GITHUB_ENV
- run: echo "CONSOLE=${{env.NAME}}.Console-${{env.VERSIONC}}.zip" >> $env:GITHUB_ENV
# - run: echo "INSTALLER=${{env.NAME}}-installer-${{env.VERSION}}.exe" >> $env:GITHUB_ENV
# Create assets
# create zip
- run: Compress-Archive -Path ${{env.OUT}}* -DestinationPath ${{env.FINALOUT}}/${{env.PORTABLE}}
- run: Compress-Archive -Path ${{env.OUTC}}* -DestinationPath ${{env.FINALOUT}}/${{env.CONSOLE}}
# create installer
# - run: .\Installers\ISCC\ISCC.exe /O"${{env.FINALOUT}}" /dMyAppBaseDir=".${{env.OUT}}" .\Installers\installer.iss
# PORTABLE
#- uses: actions/upload-artifact@v2
# with:
# name: ${{env.NAME}}-${{env.VERSION}}
# path: ${{env.OUT}}
# INSTALLER
#- uses: actions/upload-artifact@v2
# with:
# name: ${{env.NAME}}-installer-${{env.VERSION}}
# path: ${{env.FINALOUT}}/${{env.INSTALLER}}
# CONSOLE
#- uses: actions/upload-artifact@v2
# with:
# name: ${{env.NAME}}.Console-${{env.VERSIONC}}
# path: ${{env.OUTC}}
# RELEASE
- name: Release
run: |
gh release create ${{ env.VERSION }} -n "${{ env.MESSAGE }}" -t "${{ env.VERSION }}" -R ${{ env.REPO }} ${{ env.FILES }}
env:
MESSAGE: "This is a beta release so you may encounter bugs. Please report them. The latest commit this release is based on is: [#${{env.SHA}}](https://github.com/${{env.MREPO}}/commit/${{env.SHA}})"
FILES: ${{env.FINALOUT}}/${{env.PORTABLE}} ${{env.FINALOUT}}/${{env.CONSOLE}}
REPO: WolvenKit/WolvenKit-nightly-releases
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}