Skip to content

Commit

Permalink
adding dagger flow pipeline for the release
Browse files Browse the repository at this point in the history
Signed-off-by: bishal7679 <[email protected]>
  • Loading branch information
bishal7679 committed Jul 27, 2024
1 parent 4693268 commit bfc2edb
Show file tree
Hide file tree
Showing 13 changed files with 7,426 additions and 65 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dagger.gen.go linguist-generated
/querybuilder/** linguist-generated
40 changes: 25 additions & 15 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
name: Publish Release
name: Dagger Release Pipeline

on:
push:
tags:
- v*
- "v*"
branches: [main]

permissions:
contents: write
packages: write

jobs:
build:
runs-on: ubuntu-20.04
publish-release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup go env
uses: actions/setup-go@master
with:
go-version: "1.21"
- name: goreleaser with tag
uses: goreleaser/goreleaser-action@v5
- name: Set up Go
uses: actions/setup-go@v4
with:
version: latest
args: release --rm-dist
env:
go-version: "1.22.5"
cache: true

- name: Call Dagger Function
uses: dagger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: "latest"
verb: call
module: github.com/bishal7679/[email protected]
args: release --directory-arg=. --github-token=${{ env.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Dagger Pull Request Pipeline

on:
pull_request:
paths-ignore:
- '*.md'
- 'assets/**'

permissions:
contents: write # This is required for actions/checkout
packages: write # This is required for publishing the package

jobs:
test-release:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Call Dagger Function
uses: dagger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: "latest"
verb: call
module: github.com/bishal7679/[email protected]
args: pull-request --directory-arg=. --github-token=${{ env.GITHUB_TOKEN }}
48 changes: 41 additions & 7 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
project_name: harbor

before:
hooks:
- go mod tidy

builds:
- main: ./cmd/harbor/main.go

Expand All @@ -18,32 +17,67 @@ builds:
goarch:
- amd64
- arm64
- arm
ignore:
- goos: windows
goarch: arm
- goos: windows
goarch: arm64
mod_timestamp: "{{ .CommitTimestamp }}"
archives:
- format: tar.gz
format_overrides:
- goos: windows
format: zip
nfpms:
- package_name: harbor
homepage: https://github.com/goharbor/harbor-cli/
maintainer: Vadim Bauer
description: |-
[Sandbox] Official Harbor CLI
formats:
- rpm
- deb
- apk
- archlinux

sboms:
- artifacts: archive

checksum:
name_template: 'checksums.txt'

snapshot:
name_template: "{{ .Tag }}-next"

release:
name_template: "HarborCLI {{.Tag}}"
# draft: true
# prerelease: auto

changelog:
sort: asc
use: github
filters:
exclude:
- "^docs:"
- "^test:"
- "^test:"
- "merge conflict"
groups:
- title: Dependency updates
regexp: '^.*?(.+)\(deps\)!?:.+$'
order: 300
- title: "New Features"
regexp: '^.*?feat(\(.+\))??!?:.+$'
order: 100
- title: "Security updates"
regexp: '^.*?sec(\(.+\))??!?:.+$'
order: 150
- title: "Bug fixes"
regexp: '^.*?(fix|refactor)(\(.+\))??!?:.+$'
order: 200
- title: "Documentation updates"
regexp: ^.*?docs?(\(.+\))??!?:.+$
order: 400
- title: "Build process updates"
regexp: ^.*?(build|ci)(\(.+\))??!?:.+$
order: 400
- title: Other work
order: 9999
42 changes: 0 additions & 42 deletions Makefile

This file was deleted.

5 changes: 4 additions & 1 deletion cmd/harbor/root/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ harbor help
root.PersistentFlags().StringVar(&cfgFile, "config", utils.DefaultConfigPath, "config file (default is $HOME/.harbor/config.yaml)")
root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output")

viper.BindPFlag("output-format", root.PersistentFlags().Lookup("output-format"))
err := viper.BindPFlag("output-format", root.PersistentFlags().Lookup("output-format"))
if err != nil {
fmt.Println(err.Error())
}

root.AddCommand(
versionCommand(),
Expand Down
6 changes: 6 additions & 0 deletions dagger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "harbor-cli",
"sdk": "go",
"source": "dagger",
"engineVersion": "v0.9.10"
}
Loading

0 comments on commit bfc2edb

Please sign in to comment.