-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathshapeengine-release-attacher.yml
More file actions
139 lines (120 loc) · 4.47 KB
/
Copy pathshapeengine-release-attacher.yml
File metadata and controls
139 lines (120 loc) · 4.47 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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Build/Attach Examples & ResourcePacker Artifacts to ShapeEngine Releases
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Release tag to attach artifacts to"
required: true
permissions:
contents: write
jobs:
build:
env:
dotnet-version: "10.0.x"
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
runtime: win-x64
- os: ubuntu-latest
runtime: linux-x64
- os: macos-latest
runtime: osx-arm64
- os: macos-15-intel
runtime: osx-x64
runs-on: ${{ matrix.os }}
name: Build (${{ matrix.runtime }})
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.dotnet-version }}
- name: Restore dependencies
run: dotnet restore
- name: Publish Examples
run: >
dotnet publish ./Examples/Examples.csproj
-c Release
-r ${{ matrix.runtime }}
--self-contained true
-o ./publish/Examples/${{ matrix.runtime }}
- name: Verify Examples publish output
shell: bash
run: |
test -d ./publish/Examples/${{ matrix.runtime }}
test -n "$(find ./publish/Examples/${{ matrix.runtime }} -type f -print -quit)"
find ./publish/Examples/${{ matrix.runtime }} -type f | sed -n '1,10p'
- name: Publish ResourcePacker
run: >
dotnet publish ./ResourcePacker/ResourcePacker.csproj
-c Release
-r ${{ matrix.runtime }}
--self-contained true
-o ./publish/ResourcePacker/${{ matrix.runtime }}
- name: Verify ResourcePacker publish output
shell: bash
run: |
test -d ./publish/ResourcePacker/${{ matrix.runtime }}
test -n "$(find ./publish/ResourcePacker/${{ matrix.runtime }} -type f -print -quit)"
find ./publish/ResourcePacker/${{ matrix.runtime }} -type f | sed -n '1,10p'
- name: Create zip archives (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path ./artifacts | Out-Null
Compress-Archive -Path "./publish/Examples/${{ matrix.runtime }}/*" -DestinationPath "./artifacts/Examples-${{ matrix.runtime }}.zip" -Force
Compress-Archive -Path "./publish/ResourcePacker/${{ matrix.runtime }}/*" -DestinationPath "./artifacts/ResourcePacker-${{ matrix.runtime }}.zip" -Force
- name: Create zip archives (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
mkdir -p ./artifacts
cd ./publish/Examples/${{ matrix.runtime }}
zip -r "$GITHUB_WORKSPACE/artifacts/Examples-${{ matrix.runtime }}.zip" .
cd "$GITHUB_WORKSPACE"
cd ./publish/ResourcePacker/${{ matrix.runtime }}
zip -r "$GITHUB_WORKSPACE/artifacts/ResourcePacker-${{ matrix.runtime }}.zip" .
cd "$GITHUB_WORKSPACE"
- name: Verify zip archives
shell: bash
run: |
test -f ./artifacts/Examples-${{ matrix.runtime }}.zip
test -f ./artifacts/ResourcePacker-${{ matrix.runtime }}.zip
ls -lh ./artifacts
- name: Upload zipped artifacts
uses: actions/upload-artifact@v4.5.0
with:
name: ${{ matrix.runtime }}-zips
path: ./artifacts/*.zip
attach:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download zipped artifacts
uses: actions/download-artifact@v4.3.0
with:
pattern: "*-zips"
merge-multiple: true
path: ./artifacts
- name: Verify downloaded zip artifacts
shell: bash
run: |
if [ ! -d "./artifacts" ] || [ -z "$(find ./artifacts -maxdepth 1 -type f -name '*.zip' 2>/dev/null)" ]; then
echo "No zip artifacts were downloaded."
echo "Expected zip files from the matrix jobs, but none were found."
exit 1
fi
ls -lh ./artifacts
- name: Upload zip files to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.event.release.tag_name }}
files: ./artifacts/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clean up artifacts
run: rm -rf ./artifacts