Repository navigation
Expand file tree
/
Copy pathci-workflow.yml
More file actions
89 lines (82 loc) · 2.96 KB
/
Copy pathci-workflow.yml
File metadata and controls
89 lines (82 loc) · 2.96 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
name: Build XIVLauncher
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-release:
name: Build Release on Windows
runs-on: windows-2022
permissions:
id-token: write
contents: write
attestations: write
steps:
- uses: actions/checkout@v1
- name: Initialize Submodules
run: git submodule update --init --recursive
- name: Restore Nuget Packages
run: |
cd .\src\
dotnet restore
cd ..
- name: Define VERSION
run: |
$env:COMMIT = $env:GITHUB_SHA.Substring(0, 7)
$env:REPO_NAME = $env:GITHUB_REPOSITORY -replace '.*/'
$env:BRANCH = $env:GITHUB_REF -replace '.*/'
($env:REPO_NAME) >> VERSION
($env:BRANCH) >> VERSION
($env:COMMIT) >> VERSION
- name: Build Release
run: |
cd "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\"
.\MSBuild.exe $Env:GITHUB_WORKSPACE\src\XIVLauncher.sln /t:Build /p:Configuration=Release
- name: Generate Hashes File
run: |
.\scripts\CreateHashList.ps1 .\src\bin\win-x64
# 移动哈希文件到构建目录
Move-Item -Path .\src\bin\win-x64\hashes.txt -Destination .\src\Releases\
- name: Generate release tag (UTC+8)
id: generate-tag
run: |
$tzId = "China Standard Time"
$utcNow = [DateTime]::UtcNow
$cstTime = [System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId($utcNow, $tzId)
$datePart = $cstTime.ToString("yy-MM-dd")
git fetch --tags
$tags = git tag --list "$datePart-*"
$maxNumber = 0
foreach ($tag in $tags) {
$numberPart = $tag.Split('-')[-1]
if ($numberPart -match '^\d{2}$') {
$currentNumber = [int]$numberPart
$maxNumber = [Math]::Max($maxNumber, $currentNumber)
}
}
$nextNumber = $maxNumber + 1
$newTag = "{0}-{1:D2}" -f $datePart, $nextNumber
echo "new_tag=$newTag" >> $env:GITHUB_OUTPUT
echo "TAG=$newTag" >> $env:GITHUB_ENV
- name: Prepare Release Notes
run: |
@"
Automated Release
Build Date: ${{ env.TAG }} (UTC+8)
Commit: ${{ github.sha }}
Branch: ${{ github.ref_name }}
"@ | Out-File -FilePath RELEASE.md -Encoding utf8
- name: Create Release
uses: softprops/action-gh-release@a74c6b72af54cfa997e81df42d94703d6313a2d0
with:
files: |
./src/Releases/**
./src/bin/win-x64/*.exe
./src/bin/win-x64/*.dll
./src/bin/win-x64/*.json
./src/bin/win-x64/*.7z
./src/bin/win-x64/*.nupkg
tag_name: ${{ env.TAG }}
name: "Release ${{ env.TAG }}"
body_path: RELEASE.md