-
Notifications
You must be signed in to change notification settings - Fork 18
105 lines (83 loc) · 3.18 KB
/
build.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
name: Build
# Put your personal access token in a repository secret named PAT for cross-repository access
on:
workflow_dispatch:
push:
branches:
- master
env:
PUBLIC_NAME: FFLogsViewer
SOLUTION_NAME: FFLogsViewer
INTERNAL_NAME: FFLogsViewer
RELEASE_DIR: FFLogsViewer\bin\Release\FFLogsViewer
PERSONAL_PLUGIN_REPO: Aireil/MyDalamudPlugins
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
if: ${{ contains(toJSON(github.event.commits.*.message), 'build:') || contains(toJSON(github.event.commits.*.message), 'build(')}}
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Extract Branch
id: extract_branch
run: |
$branch_name = 'master'
$commit_messages = '${{ toJSON(github.event.commits) }}'
Write-Host "Commit messages: $commit_messages"
$commit_messages = $commit_messages | ConvertFrom-Json
foreach ($commit in $commit_messages) {
if ($commit.message -match 'build\(([^)]+)\):') {
$branch_name = $matches[1]
break
}
}
Write-Host "Branch name: $branch_name"
echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
- name: Setup MSBuild
uses: microsoft/[email protected]
- name: Download Dalamud
run: |
$branch_name = "${{ steps.extract_branch.outputs.branch_name }}"
Write-Host "Branch name: $branch_name"
if ($branch_name -eq 'master') {
$url = 'https://goatcorp.github.io/dalamud-distrib/latest.zip'
} else {
$url = "https://goatcorp.github.io/dalamud-distrib/$branch_name/latest.zip"
}
Write-Host "Downloading from: $url"
Invoke-WebRequest -Uri $url -OutFile latest.zip
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev\"
- name: Build
run: |
dotnet restore -r win ${{ env.SOLUTION_NAME }}.sln
dotnet build --configuration Release
- name: Test
run: |
dotnet test --no-restore --verbosity normal
- uses: actions/upload-artifact@v4
with:
name: PluginRepoZip
path: ${{ env.RELEASE_DIR }}
if-no-files-found: error
deploy:
needs: build
if: ${{ contains(toJSON(github.event.commits.*.message), 'build:') || contains(toJSON(github.event.commits.*.message), 'build(')}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
repository: ${{ env.PERSONAL_PLUGIN_REPO }}
token: ${{ secrets.PAT }}
- uses: actions/[email protected]
with:
name: PluginRepoZip
path: plugins/${{ env.INTERNAL_NAME }}
- uses: EndBug/add-and-commit@v7
with:
add: --all
author_name: GitHub Action
author_email: github-actions[bot]@users.noreply.github.com
message: Update ${{ env.INTERNAL_NAME }}