-
Notifications
You must be signed in to change notification settings - Fork 17
104 lines (89 loc) · 3.27 KB
/
build.yml
File metadata and controls
104 lines (89 loc) · 3.27 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
name: Build & Publish CS2MenuManager
on:
push:
branches:
- main
paths-ignore:
- 'README.md'
- '.github/workflows/**'
- 'config.toml'
- 'images/**'
jobs:
setup:
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
buildnumber: ${{ steps.buildnumber.outputs.build_number }}
steps:
- name: Generate build number
id: buildnumber
uses: onyxmueller/build-tag-number@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
build:
needs: setup
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Prepare Environment Variables
shell: bash
run: |
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "BUILD_NUMBER=${{ needs.setup.outputs.buildnumber }}" >> $GITHUB_ENV
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore Dependencies
run: dotnet restore
- name: Build and Pack NuGet Package
run: |
dotnet build CS2MenuManager.sln -c Release --no-restore /p:Version=1.0.${{ env.BUILD_NUMBER }}
dotnet pack CS2MenuManager/CS2MenuManager.csproj -c Release --no-build --output ./nupkg /p:Version=1.0.${{ env.BUILD_NUMBER }}
- name: Check Artifacts
run: |
echo "Listing contents of nupkg directory"
ls -la ./nupkg/
- name: Publish to NuGet
run: |
dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY_CS2MENUMANAGER }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Create Release Artifact (ZIP) from BuildOutput
run: |
mkdir -p release
cd BuildOutput
# Create zip, excluding .nupkg and .xml files
zip -r ../CS2MenuManager-v${{ env.BUILD_NUMBER }}.zip * --exclude '*.nupkg' '*.xml'
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v1.0.${{ env.BUILD_NUMBER }}
release_name: v1.0.${{ env.BUILD_NUMBER }}
draft: false
prerelease: false
body: |
## Release Notes for v1.0.${{ env.BUILD_NUMBER }}
---
### Changes:
- ${{ github.event.head_commit.message }}
---
### Feedback:
- If you encounter any issues, please report them [here](https://github.com/${{ github.repository }}/issues).
---
### Support:
If you'd like to support the continued development of this project, you can do so by [buying me a coffee](https://buymeacoffee.com/schwarper). Your support is genuinely appreciated.
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./CS2MenuManager-v${{ env.BUILD_NUMBER }}.zip
asset_name: CS2MenuManager-v${{ env.BUILD_NUMBER }}.zip
asset_content_type: application/zip