-
Notifications
You must be signed in to change notification settings - Fork 18
72 lines (70 loc) · 2.43 KB
/
build.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
name: Build RetakesAllocator.zip
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types:
- created
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore Dependencies
run: dotnet restore
- name: Build
shell: bash
run: dotnet build --no-restore -c Release
- name: Package
working-directory: ${{github.workspace}}/RetakesAllocator/
run: chmod +x release.bash; ./release.bash
- name: Publish Archive for Branch
uses: actions/upload-artifact@v4
if: "!startsWith(github.ref, 'refs/tags/')"
with:
name: RetakesAllocator-${{github.sha}}
path: ${{github.workspace}}/RetakesAllocator/bin/Release/RetakesAllocator
- name: Publish Archive for Release
uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/')
with:
name: RetakesAllocator-${{github.ref_name}}
path: ${{github.workspace}}/RetakesAllocator/bin/Release/RetakesAllocator
release:
needs: build
permissions: write-all
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v4
name: Fetch Artifact
with:
name: RetakesAllocator-${{github.ref_name}}
- name: tree
run: tree
- name: Create Archive
run: zip -r RetakesAllocator-${{github.ref_name}}.zip .
- name: tree2
run: tree
- name: Get Release Info
id: get-release-info
run: |
RELEASE_INFO=$(curl -sH 'Accept: application/vnd.github.v3+json' https://api.github.com/repos/${{ github.repository }}/releases)
export UPLOAD_URL=$(echo $RELEASE_INFO | jq -r ".[] | select(.tag_name == \"${{ github.event.release.tag_name }}\").upload_url")
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./RetakesAllocator-{{github.ref_name}}.zip
asset_name: "cs2-retakes-allocator-${{ github.event.release.tag_name }}.zip"
asset_content_type: application/zip