Skip to content

Commit c7abe9f

Browse files
NucleoFusionbupd
andauthored
fix: fixing release error (goharbor#601)
Co-authored-by: bupd <bupdprasanth@gmail.com>
1 parent 77d6dbb commit c7abe9f

2 files changed

Lines changed: 72 additions & 27 deletions

File tree

.dagger/release.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (m *HarborCli) PublishRelease(ctx context.Context,
4545
return ctr.
4646
WithWorkdir("/src").
4747
// Creating Release
48-
WithExec([]string{"gh", "release", "create", "v" + m.AppVersion, "--generate-notes"}).
48+
// WithExec([]string{"gh", "release", "create", "v" + m.AppVersion, "--generate-notes"}).
4949
WithExec(cmd).
5050
Stdout(ctx)
5151
}

.github/workflows/default.yaml

Lines changed: 71 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ on:
99
paths-ignore:
1010
- "*.md"
1111
- "assets/**"
12+
release:
13+
types: [published, released]
14+
workflow_dispatch: # Allow manual trigger on existing releases
15+
inputs:
16+
tag:
17+
description: 'Tag to build (e.g., v1.0.0)'
18+
required: true
1219

1320
permissions:
1421
contents: write
@@ -23,6 +30,7 @@ jobs:
2330
fetch-depth: 0
2431

2532
- name: Dagger Version
33+
id: dagger_version
2634
uses: sagikazarmark/dagger-version-action@v0.0.1
2735

2836
- name: Generate Document
@@ -75,6 +83,7 @@ jobs:
7583
fetch-depth: 0
7684

7785
- name: Dagger Version
86+
id: dagger_version
7887
uses: sagikazarmark/dagger-version-action@v0.0.1
7988

8089
- name: Run Vulnerability Check
@@ -103,6 +112,10 @@ jobs:
103112
with:
104113
fetch-depth: 0
105114

115+
- name: Dagger Version
116+
id: dagger_version
117+
uses: sagikazarmark/dagger-version-action@v0.0.1
118+
106119
- name: Run Tests
107120
uses: dagger/dagger-for-github@v7
108121
with:
@@ -188,66 +201,88 @@ jobs:
188201
packages: write
189202
id-token: write
190203
runs-on: ubuntu-latest
191-
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/'))
204+
if: |
205+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
206+
(github.event_name == 'release') ||
207+
(github.event_name == 'workflow_dispatch')
192208
steps:
193209
- name: Checkout repo
194-
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
195-
uses: actions/checkout@v4
196-
with:
197-
fetch-depth: 0
198-
199-
- name: Checkout repo
200-
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/'))
210+
if: |
211+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
212+
(github.event_name == 'release') ||
213+
(github.event_name == 'workflow_dispatch')
201214
uses: actions/checkout@v4
202215
with:
203216
fetch-depth: 0
217+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
204218

205219
- name: Create Build Dir
206-
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/'))
220+
if: |
221+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
222+
(github.event_name == 'release') ||
223+
(github.event_name == 'workflow_dispatch')
207224
run: mkdir -p dist
208225

209-
- name: Building Binaries
210-
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/'))
226+
- name: Building Binaries
227+
if: |
228+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
229+
(github.event_name == 'release') ||
230+
(github.event_name == 'workflow_dispatch')
211231
uses: dagger/dagger-for-github@v7
212232
with:
213233
version: "latest"
214234
verb: call
215235
args: "build --build-dir=./dist export --path=./dist"
216-
217-
- name: Archiving Binaries
218-
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/'))
236+
237+
- name: Archiving Binaries
238+
if: |
239+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
240+
(github.event_name == 'release') ||
241+
(github.event_name == 'workflow_dispatch')
219242
uses: dagger/dagger-for-github@v7
220243
with:
221244
version: "latest"
222245
verb: call
223246
args: "archive --build-dir=./dist export --path=./dist"
224247

225-
- name: NFPM Build (deb/rpm)
226-
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/'))
248+
- name: NFPM Build (deb/rpm)
249+
if: |
250+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
251+
(github.event_name == 'release') ||
252+
(github.event_name == 'workflow_dispatch')
227253
uses: dagger/dagger-for-github@v7
228254
with:
229255
version: "latest"
230256
verb: call
231257
args: "nfpm-build --build-dir=./dist export --path=./dist"
232258

233-
- name: APK Build (.apk)
234-
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/'))
259+
- name: APK Build (.apk)
260+
if: |
261+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
262+
(github.event_name == 'release') ||
263+
(github.event_name == 'workflow_dispatch')
235264
uses: dagger/dagger-for-github@v7
236265
with:
237266
version: "latest"
238267
verb: call
239268
args: "apk --build-dir=./dist export --path=./dist"
240269

241-
- name: Creating Checksum
242-
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/'))
270+
- name: Creating Checksum
271+
if: |
272+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
273+
(github.event_name == 'release') ||
274+
(github.event_name == 'workflow_dispatch')
243275
uses: dagger/dagger-for-github@v7
244276
with:
245277
version: "latest"
246278
verb: call
247279
args: "checksum --build-dir=./dist export --path=./dist"
248280

249-
- name: Publish Release
250-
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/'))
281+
- name: Publish Release
282+
if: |
283+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
284+
(github.event_name == 'release') ||
285+
(github.event_name == 'workflow_dispatch')
251286
uses: dagger/dagger-for-github@v7
252287
env:
253288
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -256,8 +291,11 @@ jobs:
256291
verb: call
257292
args: "publish-release --build-dir=./dist --token=env://GITHUB_TOKEN "
258293

259-
- name: Apt Build
260-
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/'))
294+
- name: Apt Build
295+
if: |
296+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
297+
(github.event_name == 'release') ||
298+
(github.event_name == 'workflow_dispatch')
261299
uses: dagger/dagger-for-github@v7
262300
env:
263301
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -267,16 +305,23 @@ jobs:
267305
args: "apt-build --build-dir=./dist --token=env://GITHUB_TOKEN "
268306

269307
- name: Upload Build Artifact
308+
if: |
309+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
310+
(github.event_name == 'release') ||
311+
(github.event_name == 'workflow_dispatch')
270312
uses: actions/upload-artifact@v4
271313
with:
272314
name: build-dir
273315
path: ./dist
274316

275317
- name: Publish and Sign Tagged Image
276-
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/'))
318+
if: |
319+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
320+
(github.event_name == 'release') ||
321+
(github.event_name == 'workflow_dispatch')
277322
uses: ./.github/actions/publish-and-sign
278323
with:
279-
IMAGE_TAGS: "latest,${{ github.ref_name }}"
324+
IMAGE_TAGS: "latest,${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}"
280325
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
281326
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
282327
REGISTRY_ADDRESS: ${{ vars.REGISTRY_ADDRESS }}

0 commit comments

Comments
 (0)