Repository navigation
80 lines (71 loc) · 2.32 KB
/
Copy pathrelease.yml
File metadata and controls
80 lines (71 loc) · 2.32 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
name: Release
# Runs ONLY when you publish a release on GitHub (Releases → Draft a new release
# → choose/create a tag → Publish). Ordinary commits/pushes do NOT trigger this
# and never create a release. On publish, this builds the Release binaries and
# attaches them to that release automatically (they appear a couple of minutes
# after publishing, once the build finishes).
on:
release:
types: [ published ]
jobs:
build:
name: Build ${{ matrix.rid }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- rid: linux-x64
artifact: photon-server-linux-x64
- rid: linux-arm64
artifact: photon-server-linux-arm64
- rid: win-x64
artifact: photon-server-win-x64
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Publish
run: |
dotnet publish photon-server.csproj \
--configuration Release \
--runtime ${{ matrix.rid }} \
--self-contained true \
-p:PublishSingleFile=true \
--output publish/${{ matrix.rid }}
- name: Package
run: |
cd publish
if [[ "${{ matrix.rid }}" == *win* ]]; then
zip -j ${{ matrix.artifact }}.zip ${{ matrix.rid }}/*
else
tar -czf ${{ matrix.artifact }}.tar.gz -C ${{ matrix.rid }} .
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: |
publish/*.tar.gz
publish/*.zip
attach-binaries:
name: Attach binaries to the release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Upload binaries to the published release
env:
GH_TOKEN: ${{ github.token }}
run: |
tag="${{ github.event.release.tag_name }}"
files=$(find dist -type f \( -name '*.zip' -o -name '*.tar.gz' \))
echo "Attaching to release '$tag':"
echo "$files"
gh release upload "$tag" $files --clobber --repo "${{ github.repository }}"