-
Notifications
You must be signed in to change notification settings - Fork 3
54 lines (52 loc) · 2.24 KB
/
ci.yml
File metadata and controls
54 lines (52 loc) · 2.24 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
name: .NET CI builds
on:
push:
branches: ["main"]
jobs:
publish:
name: Publish for ${{ matrix.platform }} ${{ matrix.arch }} (${{ matrix.self-contained == 'true' && 'self-contained' || 'runtime' }})
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
# The runtime id will be composed based on parts of the .NET Known RIDs (https://learn.microsoft.com/en-us/dotnet/core/rid-catalog#known-rids)
arch: ["x64", "arm64"]
platform: ["win", "linux"]
self-contained: ["true", "false"]
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore --runtime ${{ matrix.platform }}-${{ matrix.arch }}
- name: Publish
run: dotnet publish Hexus --no-restore --runtime ${{ matrix.platform }}-${{ matrix.arch }} --self-contained ${{ matrix.self-contained }}
- name: Prepare artifact for CI release
run: |
cd artifacts/publish/Hexus/release_${{ matrix.platform }}-${{ matrix.arch }}
tar -czf ../../../../${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.self-contained == 'true' && 'self-contained' || 'runtime' }}.tar.gz *
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
path: ./${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.self-contained == 'true' && 'self-contained' || 'runtime' }}.tar.gz
name: ${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.self-contained == 'true' && 'self-contained' || 'runtime' }}.tar.gz
if-no-files-found: error
- name: Upload artifact to CI release
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload ci ${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.self-contained == 'true' && 'self-contained' || 'runtime' }}.tar.gz --clobber
edit-ci-release:
name: Edit CI release
runs-on: ubuntu-latest
needs: publish
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Edit CI release
env:
GH_TOKEN: ${{ github.token }}
run: gh release edit ci -n "CI build for commit $GITHUB_SHA"