Skip to content

Commit 2fbbdd1

Browse files
Merge pull request #10 from fadhly-permata/dev
Switch to release-based publishing and simplify workflow
2 parents 4ef2396 + 05f6500 commit 2fbbdd1

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

.github/workflows/publish.yml

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,44 @@
1-
name: Publish JQL.Net to NuGet and GitHub Release
1+
name: Auto Publish JQL.Net
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
4+
release:
5+
types: [published] # Triggers saat Anda klik "Publish Release" di GitHub
76

87
jobs:
9-
publish:
8+
build-and-deploy:
109
runs-on: ubuntu-latest
11-
permissions: # Diperlukan untuk membuat GitHub Release
10+
permissions:
1211
contents: write
13-
12+
1413
steps:
1514
- uses: actions/checkout@v4
1615
with:
17-
fetch-depth: 0 # Mengambil seluruh histori untuk generate changelog
16+
fetch-depth: 0
1817

1918
- name: Setup .NET
2019
uses: actions/setup-dotnet@v4
2120
with:
2221
dotnet-version: '8.0.x'
2322

24-
- name: Restore
25-
run: dotnet restore
26-
27-
- name: Build
28-
run: dotnet build --configuration Release --no-restore
23+
- name: Restore & Build
24+
run: |
25+
dotnet restore
26+
dotnet build --configuration Release --no-restore
2927
3028
- name: Test
31-
run: dotnet test --configuration Release --no-build --verbosity normal
29+
run: dotnet test --configuration Release --no-build
3230

33-
- name: Pack
34-
# Membuat paket NuGet (.nupkg)
35-
run: dotnet pack --configuration Release --no-build -o dist
31+
- name: Pack with Dynamic Version
32+
run: |
33+
# Mengambil nama tag (misal v1.0.5) dan membuang huruf 'v'-nya
34+
VERSION=${GITHUB_REF_NAME#v}
35+
dotnet pack --configuration Release --no-build -o dist /p:PackageVersion=$VERSION
3636
3737
- name: Push to NuGet
3838
run: dotnet nuget push dist/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
3939

40-
- name: Create GitHub Release
40+
- name: Upload to GitHub Release
4141
uses: softprops/action-gh-release@v2
4242
with:
43-
files: dist/*.nupkg # Melampirkan file paket ke halaman release GitHub
44-
generate_release_notes: true # Otomatis membuat daftar commit sebagai changelog
45-
draft: false
46-
prerelease: false
43+
files: dist/*.nupkg
44+
generate_release_notes: true

0 commit comments

Comments
 (0)