Skip to content

Commit 701764f

Browse files
committed
Fixed github action
1 parent c87740e commit 701764f

1 file changed

Lines changed: 40 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
name: Build
22

33
on:
4+
workflow_dispatch:
45
push:
5-
branches: [main]
66
tags: ['v*']
7-
pull_request:
8-
branches: [main]
9-
workflow_dispatch:
107

118
jobs:
129
build:
@@ -34,9 +31,46 @@ jobs:
3431
- name: Publish (AOT)
3532
run: dotnet publish ClaudeUsageMonitor.csproj -c Release -r ${{ matrix.rid }} -o publish/${{ matrix.rid }}
3633

34+
- name: Package (Linux)
35+
if: runner.os == 'Linux'
36+
run: |
37+
cd publish/${{ matrix.rid }}
38+
tar -czf ../../${{ matrix.artifact }}.tar.gz .
39+
40+
- name: Package (Windows)
41+
if: runner.os == 'Windows'
42+
shell: pwsh
43+
run: Compress-Archive -Path publish/${{ matrix.rid }}/* -DestinationPath ${{ matrix.artifact }}.zip
44+
3745
- name: Upload artifact
3846
uses: actions/upload-artifact@v4
3947
with:
4048
name: ${{ matrix.artifact }}
41-
path: publish/${{ matrix.rid }}
42-
if-no-files-found: error
49+
path: |
50+
${{ matrix.artifact }}.tar.gz
51+
${{ matrix.artifact }}.zip
52+
if-no-files-found: ignore
53+
54+
release:
55+
needs: build
56+
if: startsWith(github.ref, 'refs/tags/v')
57+
runs-on: ubuntu-latest
58+
permissions:
59+
contents: write
60+
61+
steps:
62+
- name: Download artifacts
63+
uses: actions/download-artifact@v4
64+
with:
65+
path: artifacts
66+
merge-multiple: true
67+
68+
- name: Create release
69+
env:
70+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
run: |
72+
gh release create "${GITHUB_REF_NAME}" \
73+
--repo "${GITHUB_REPOSITORY}" \
74+
--title "${GITHUB_REF_NAME}" \
75+
--generate-notes \
76+
artifacts/*

0 commit comments

Comments
 (0)