-
-
Notifications
You must be signed in to change notification settings - Fork 91
115 lines (94 loc) · 4.4 KB
/
update_dlls.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
name: Update DLLs 📚
on:
workflow_dispatch:
jobs:
update_dlls:
name: Update Yarn Spinner DLLs
runs-on: ubuntu-latest
permissions:
# We need to be able to:
# 1. create a branch in a repo ('contents'), and
# 2. create a pull request using that branch ('pull-requests')
pull-requests: write
contents: write
steps:
- name: Checkout Yarn Spinner for Unity
uses: actions/checkout@v2
with:
path: YarnSpinner-Unity
- name: Checkout Yarn Spinner
uses: actions/checkout@v2
with:
repository: YarnSpinnerTool/YarnSpinner
path: YarnSpinner
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Fetch all commits
run: git fetch --unshallow
working-directory: ./YarnSpinner
- uses: gittools/actions/gitversion/setup@v0.9.10
name: Install GitVersion
with:
versionSpec: '5.x'
- name: Install dotnet-assembly-alias
run: dotnet tool install -g Alias
# Update the assembly info for this build of YS, so that the About window is
# appropriate
- uses: gittools/actions/gitversion/execute@v0.9.10
name: Execute GitVersion
id: gitversion # step id used as reference for output values
with:
updateAssemblyInfo: true
targetPath: ./YarnSpinner
- name: Print version information
run: |
echo "Major: ${{ steps.gitversion.outputs.major }}"
echo "Minor: ${{ steps.gitversion.outputs.minor }}"
echo "Patch: ${{ steps.gitversion.outputs.patch }}"
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
- name: Restore dependencies
run: dotnet restore
working-directory: ./YarnSpinner
- name: Build
run: dotnet build --no-restore --configuration Release
working-directory: ./YarnSpinner
# Don't proceed unless we're including a build of Yarn Spinner that passes
# its tests.
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal
working-directory: ./YarnSpinner
# We need to copy dependency DLLs into the project, but if a Unity project
# contains multiple DLLs with the same name (even from a package), that's an
# error. This causes problems for users who want to use, for example,
# Google.Protobuf (especially if they want to use a different version).
#
# Our solution partly involves renaming the dependency DLLs to have the
# prefix 'Yarn.', and updating all references to these renamed DLLs, using
# dotnet-assembly-alias
# (https://github.com/getsentry/dotnet-assembly-alias/). For more
# information on this fix, see
# https://github.com/YarnSpinnerTool/YarnSpinner-Unity/issues/15#issuecomment-1036162152.
- name: Rename vendored DLLs
run: |
assemblyalias --target-directory "YarnSpinner/YarnSpinner.Compiler/bin/Release/netstandard2.0/" --prefix "Yarn." --assemblies-to-alias "Antlr*;Csv*;Google*;"
assemblyalias --target-directory "YarnSpinner/YarnSpinner.Compiler/bin/Release/netstandard2.0/" --internalize --prefix "Yarn." --assemblies-to-alias "System*;Microsoft.Bcl*;Microsoft.Extensions*"
# Copy all of the dependency DLLs into the YarnSpinner-Unity repo, except
# for Microsoft.CSharp.dll (which is provided by Unity, so including it
# would cause an error.)
- name: Copy DLLs
run: |
cp -v YarnSpinner/YarnSpinner.Compiler/bin/Release/netstandard2.0/*.dll YarnSpinner-Unity/Runtime/DLLs
rm -fv YarnSpinner-Unity/Runtime/DLLs/Microsoft.CSharp.dll
# Make the PR against YarnSpinner-Unity that merges this change
- name: Create pull request
uses: peter-evans/create-pull-request@v3
with:
path: ./YarnSpinner-Unity
commit-message: Update Yarn Spinner DLLs to YarnSpinnerTool/YarnSpinner@${{ steps.gitversion.outputs.shortSha }}
branch: update-dlls-${{ steps.gitversion.outputs.shortSha }}
title: Update Yarn Spinner DLLs to latest (${{ steps.gitversion.outputs.shortSha }})
body: |
This is an automated PR made by @${{ github.actor }} that updates the precompiled Yarn Spinner DLLs (and their dependencies) to YarnSpinnerTool/YarnSpinner@${{ steps.gitversion.outputs.shortSha }} (v${{ steps.gitversion.outputs.fullSemVer }}).