-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (70 loc) · 3.38 KB
/
release.yml
File metadata and controls
90 lines (70 loc) · 3.38 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
name: Release
on:
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate tag
id: tag
run: |
date=$(date +%Y.%m.%d)
base_tag="v$date"
counter=0
tag="$base_tag"
while git tag -l "$tag" | grep -q .; do
counter=$((counter + 1))
tag="$base_tag.$counter"
done
# Extract version without 'v' prefix for NuGet
version="${tag#v}"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Generated tag: $tag (version: $version)"
- name: Create and push tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ steps.tag.outputs.tag }}
git push origin ${{ steps.tag.outputs.tag }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal
- name: Pack NuGet
run: dotnet pack DotSchema/DotSchema.csproj --no-build --configuration Release -p:Version=${{ steps.tag.outputs.version }} --output ./artifacts
- name: Publish Windows x64
run: dotnet publish DotSchema/DotSchema.csproj --configuration Release --runtime win-x64 --self-contained -p:PublishSingleFile=true -p:Version=${{ steps.tag.outputs.version }} --output ./artifacts/win-x64
- name: Publish Linux x64
run: dotnet publish DotSchema/DotSchema.csproj --configuration Release --runtime linux-x64 --self-contained -p:PublishSingleFile=true -p:Version=${{ steps.tag.outputs.version }} --output ./artifacts/linux-x64
- name: Publish macOS x64
run: dotnet publish DotSchema/DotSchema.csproj --configuration Release --runtime osx-x64 --self-contained -p:PublishSingleFile=true -p:Version=${{ steps.tag.outputs.version }} --output ./artifacts/osx-x64
- name: Publish macOS ARM64
run: dotnet publish DotSchema/DotSchema.csproj --configuration Release --runtime osx-arm64 --self-contained -p:PublishSingleFile=true -p:Version=${{ steps.tag.outputs.version }} --output ./artifacts/osx-arm64
- name: Zip artifacts
run: |
chmod +x artifacts/linux-x64/dotschema artifacts/osx-x64/dotschema artifacts/osx-arm64/dotschema
cd artifacts/win-x64 && zip ../dotschema-win-x64-${{ steps.tag.outputs.tag }}.zip dotschema.exe && cd ../..
cd artifacts/linux-x64 && zip ../dotschema-linux-x64-${{ steps.tag.outputs.tag }}.zip dotschema && cd ../..
cd artifacts/osx-x64 && zip ../dotschema-osx-x64-${{ steps.tag.outputs.tag }}.zip dotschema && cd ../..
cd artifacts/osx-arm64 && zip ../dotschema-osx-arm64-${{ steps.tag.outputs.tag }}.zip dotschema && cd ../..
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.tag }}
files: |
artifacts/*.nupkg
artifacts/*.zip
generate_release_notes: true