Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamping building and release with dagger multibuild pipeline 2.0 #133

Merged
merged 9 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.1
args: release --directory-arg=. --github-token=${{ env.GITHUB_TOKEN }}
53 changes: 53 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22.5"
cache: true

- name: Install dependencies
run: go mod download

- name: Test with the Go CLI
run: go test -v ./...

# - 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.1
# 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.1
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
Loading