Skip to content

Commit e9b449d

Browse files
committed
Changed how build action works.
1 parent 6cb1d8d commit e9b449d

File tree

1 file changed

+56
-55
lines changed

1 file changed

+56
-55
lines changed

.github/workflows/build.workflow.yml

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@ jobs:
1717
build-linux:
1818
runs-on: ubuntu-latest
1919

20-
permissions:
21-
contents: write
22-
2320
steps:
2421
- name: Check out repository
25-
uses: actions/checkout@v4
22+
uses: actions/checkout@v4.2.2
2623
with:
2724
ref: ${{ github.event.pull_request.head.ref }}
2825

@@ -31,35 +28,22 @@ jobs:
3128
mkdir -p build
3229
g++ -std=c++17 -shared -fPIC -o build/libRhythmGameUtilities.so include/RhythmGameUtilities/RhythmGameUtilities.cpp
3330
34-
- name: Copy Release
35-
run: |
36-
mkdir -p UnityPackage/Libs/Linux
37-
mkdir -p RhythmGameUtilities/Libs/Linux
38-
cp build/libRhythmGameUtilities.so UnityPackage/Libs/Linux
39-
cp build/libRhythmGameUtilities.so RhythmGameUtilities/Libs/Linux
40-
41-
- name: Setup git
42-
run: |
43-
git config user.name 'github-actions[bot]'
44-
git config user.email 'github-actions[bot]@users.noreply.github.com'
31+
- name: Upload build artifacts
32+
uses: actions/[email protected]
33+
with:
34+
name: build-linux-files
35+
path: build/
36+
retention-days: 1
4537

46-
- name: Git commit changes
47-
run: |
48-
git pull
49-
git add UnityPackage/Libs/Linux/libRhythmGameUtilities.so
50-
git add RhythmGameUtilities/Libs/Linux/libRhythmGameUtilities.so
51-
git commit -m "Updated libRhythmGameUtilities.so [skip ci]" || exit 0
52-
git push
5338
build-macos:
5439
runs-on: macos-latest
55-
needs: build-linux
5640

5741
permissions:
5842
contents: write
5943

6044
steps:
6145
- name: Check out repository
62-
uses: actions/checkout@v4
46+
uses: actions/checkout@v4.2.2
6347
with:
6448
ref: ${{ github.event.pull_request.head.ref }}
6549

@@ -71,35 +55,22 @@ jobs:
7155
lipo -create -output build/libRhythmGameUtilities.dylib build/libRhythmGameUtilities-arm64.dylib build/libRhythmGameUtilities-x86_64.dylib
7256
lipo -info build/libRhythmGameUtilities.dylib
7357
74-
- name: Copy Release
75-
run: |
76-
mkdir -p UnityPackage/Libs/macOS
77-
mkdir -p RhythmGameUtilities/Libs/macOS
78-
cp build/libRhythmGameUtilities.dylib UnityPackage/Libs/macOS
79-
cp build/libRhythmGameUtilities.dylib RhythmGameUtilities/Libs/macOS
80-
81-
- name: Setup git
82-
run: |
83-
git config user.name 'github-actions[bot]'
84-
git config user.email 'github-actions[bot]@users.noreply.github.com'
58+
- name: Upload build artifacts
59+
uses: actions/[email protected]
60+
with:
61+
name: build-macos-files
62+
path: build/
63+
retention-days: 1
8564

86-
- name: Git commit changes
87-
run: |
88-
git pull
89-
git add UnityPackage/Libs/macOS/libRhythmGameUtilities.dylib
90-
git add RhythmGameUtilities/Libs/macOS/libRhythmGameUtilities.dylib
91-
git commit -m "Updated libRhythmGameUtilities.dylib [skip ci]" || exit 0
92-
git push
9365
build-windows:
9466
runs-on: windows-latest
95-
needs: build-macos
9667

9768
permissions:
9869
contents: write
9970

10071
steps:
10172
- name: Check out repository
102-
uses: actions/checkout@v4
73+
uses: actions/checkout@v4.2.2
10374
with:
10475
ref: ${{ github.event.pull_request.head.ref }}
10576

@@ -112,25 +83,55 @@ jobs:
11283
link /DLL /MACHINE:X64 /OUT:build\libRhythmGameUtilities.dll /IMPLIB:build\libRhythmGameUtilities.lib build\RhythmGameUtilities.obj
11384
del build\RhythmGameUtilities.obj
11485
115-
- name: Copy Release
116-
shell: cmd
86+
- name: Upload build artifacts
87+
uses: actions/[email protected]
88+
with:
89+
name: build-windows-files
90+
path: build/
91+
retention-days: 1
92+
93+
commit-changes:
94+
needs: [build-linux, build-macos, build-windows]
95+
runs-on: ubuntu-latest
96+
97+
permissions:
98+
contents: write
99+
100+
steps:
101+
- name: Check out repository
102+
uses: actions/[email protected]
103+
with:
104+
fetch-depth: 0
105+
106+
- name: Download all build artifacts
107+
uses: actions/[email protected]
108+
with:
109+
path: artifacts/
110+
111+
- name: Move artifacts to build directory
117112
run: |
118-
mkdir UnityPackage/Libs/Windows
119-
mkdir RhythmGameUtilities/Libs/Windows
120-
cp build/libRhythmGameUtilities.dll UnityPackage/Libs/Windows
121-
cp build/libRhythmGameUtilities.dll RhythmGameUtilities/Libs/Windows
113+
mkdir -p UnityPackage/Libs/Linux
114+
mkdir -p RhythmGameUtilities/Libs/Linux
115+
mkdir -p UnityPackage/Libs/macOS
116+
mkdir -p RhythmGameUtilities/Libs/macOS
117+
mkdir -p UnityPackage/Libs/Windows
118+
mkdir -p RhythmGameUtilities/Libs/Windows
119+
cp artifacts/build-linux-files/libRhythmGameUtilities.so UnityPackage/Libs/Linux/
120+
cp artifacts/build-linux-files/libRhythmGameUtilities.so RhythmGameUtilities/Libs/Linux/
121+
cp artifacts/build-macos-files/libRhythmGameUtilities.dylib UnityPackage/Libs/macOS/
122+
cp artifacts/build-macos-files/libRhythmGameUtilities.dylib RhythmGameUtilities/Libs/macOS/
123+
cp artifacts/build-windows-files/libRhythmGameUtilities.dll UnityPackage/Libs/Windows/
124+
cp artifacts/build-windows-files/libRhythmGameUtilities.dll RhythmGameUtilities/Libs/Windows/
122125
123126
- name: Setup git
124-
shell: cmd
125127
run: |
126128
git config user.name 'github-actions[bot]'
127129
git config user.email 'github-actions[bot]@users.noreply.github.com'
128130
129131
- name: Git commit changes
130-
shell: cmd
131132
run: |
132133
git pull
133-
git add UnityPackage/Libs/Windows/libRhythmGameUtilities.dll
134-
git add RhythmGameUtilities/Libs/Windows/libRhythmGameUtilities.dll
135-
git commit -m "Updated libRhythmGameUtilities.dll [skip ci]" || exit 0
134+
git add UnityPackage/
135+
git add RhythmGameUtilities/
136+
git commit -m "Updated build files [skip ci]" || exit 0
136137
git push

0 commit comments

Comments
 (0)