Skip to content

Commit

Permalink
added dagger pipeline for release
Browse files Browse the repository at this point in the history
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
  • Loading branch information
bishal7679 committed Jul 28, 2024
1 parent 90e1852 commit e77af6a
Show file tree
Hide file tree
Showing 22 changed files with 10,698 additions and 82 deletions.
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/dagger-for-github@v6.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: "latest"
verb: call
module: github.com/bishal7679/harbor-cli@v0.6.0
args: release --directory-arg=. --github-token=${{ env.GITHUB_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Dagger Pull Request Pipeline

on:
push:
branches: [main]
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-code:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Call Linting Function
uses: dagger/dagger-for-github@v6.1.0
with:
version: "latest"
verb: call
module: github.com/bishal7679/harbor-cli@v0.6.0
args: lint-code --directory-arg=.

- name: Call Pull-Request Function
uses: dagger/dagger-for-github@v6.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: "latest"
verb: call
module: github.com/bishal7679/harbor-cli@v0.6.0
args: pull-request --directory-arg=. --github-token=${{ env.GITHUB_TOKEN }}
47 changes: 41 additions & 6 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project_name: harbor
before:
hooks:
- go mod tidy

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

Expand All @@ -18,32 +18,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
Loading

0 comments on commit e77af6a

Please sign in to comment.