-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (92 loc) · 3.44 KB
/
release.yml
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
name: Build and Release
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release
release:
needs: build
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release
- name: Create Directories
run: |
mkdir -p plugin/plugins/Zones
mkdir -p plugin/shared/RetakesPluginShared
mkdir -p plugin/configs/plugins/Zones
- name: Move Files
run: |
mv ./src/bin/Release/net8.0/* ./plugin/plugins/Zones
mv ./cs2-retakes/RetakesPluginShared/bin/Release/net8.0/* ./plugin/shared/RetakesPluginShared
mv ./config/* plugin/configs/plugins/Zones
- name: Remove .API
run: |
rm ./plugin/plugins/Zones/RetakesPluginShared.*
- name: Zip
run: |
cd plugin/
zip -r Zones-${{ github.sha }}.zip .
- name: Extract version and create tag
id: extract_version
run: |
version=$(grep -oP 'public override string ModuleVersion => "\K(.*)(?=";)' ./src/Globals.cs)
echo "Version found: $version"
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git tag $version
git push origin $version
echo "::set-output name=version::$version"
- name: Publish
uses: actions/upload-artifact@v4
with:
name: Zones-${{ github.sha }}
path: plugin
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.extract_version.outputs.version }}
release_name: ${{ steps.extract_version.outputs.version }}
body: |
This is an automated release.
draft: false
prerelease: false
- name: Upload Release Asset
id: 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: ./plugin/Zones-${{ github.sha }}.zip
asset_name: Zones.zip
asset_content_type: application/zip