From 50b29328d8294281324e6a349dc79d0d3ee91545 Mon Sep 17 00:00:00 2001 From: Guilherme Teixeira <4645845+gateixeira@users.noreply.github.com> Date: Fri, 5 May 2023 14:43:58 +0200 Subject: [PATCH] Add workflow files and banner --- .github/dependabot.yml | 14 ++++++++++++++ .github/workflows/build.yml | 26 ++++++++++++++++++++++++++ .github/workflows/release.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/report.yml | 2 -- .gitignore | 3 ++- Makefile | 13 +++++++------ README.md | 2 +- cmd/banner.txt | 10 ++++++++++ cmd/root.go | 9 +++++++++ main.go | 2 +- 10 files changed, 100 insertions(+), 11 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml create mode 100644 cmd/banner.txt diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..8903f38 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +version: 2 +updates: + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "weekly" + reviewers: + - gateixeira + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly + reviewers: + - gateixeira diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a3d168f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,26 @@ +name: Build + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.20.x + + - name: Build + run: make build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..cd08464 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: Release + +on: + push: + tags: + - v*.*.* + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.20.x + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v4 + with: + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index d6cc2bc..b15afa3 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -1,7 +1,5 @@ name: "Generate Licenses Report" on: - schedule: - - cron: "0 0 1 * *" workflow_dispatch: permissions: diff --git a/.gitignore b/.gitignore index 3c384fd..a703a02 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ bin/ .DS_Store report.html -enterprise-licenses-report \ No newline at end of file +enterprise-licenses-report +dist/ \ No newline at end of file diff --git a/Makefile b/Makefile index 15595f9..193cafc 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ +clean: + rm -rf dist/ build: - go build -o bin/enterprise-licenses-report main.go -compile: - GOOS=linux GOARCH=arm go build -o bin/enterprise-licenses-report-linux-arm main.go - GOOS=linux GOARCH=amd64 go build -o bin/enterprise-licenses-report-linux-amd64 main.go - GOOS=windows GOARCH=amd64 go build -o bin/enterprise-licenses-report-windows-amd64 main.go - GOOS=darwin GOARCH=arm64 go build -o bin/enterprise-licenses-report-darwin-arm64 main.go \ No newline at end of file + go build -o dist/gei-migration-helper main.go +snapshot: + goreleaser release --snapshot +release: + goreleaser release \ No newline at end of file diff --git a/README.md b/README.md index 49e46b9..64fbaab 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Or set it up as an Action workflow: ```yml - name: Generate Report - uses: ./ + uses: gateixeira/enterprise-licenses-report@main env: GITHUB_ENTERPRISE_SLUG: "" GITHUB_PAT: ${{ secrets.PAT }} diff --git a/cmd/banner.txt b/cmd/banner.txt new file mode 100644 index 0000000..c11f1dc --- /dev/null +++ b/cmd/banner.txt @@ -0,0 +1,10 @@ +o.OOoOoo o `OooOOo. + O o O o o `o + o O o O O O + ooOO oOo o o .O oOo + O 'OoOo. o .oOo. `OoOo. .oOo. `OoOo. O .oOo .oOo. O O .oOo .oOo. 'OoOo. .oOo .oOo. .oOo OOooOO' .oOo. .oOo. .oOo. `OoOo. o + o o O O OooO' o O o o o `Ooo. OooO' O o O OooO' o O `Ooo. OooO' `Ooo. o o OooO' O o O o o O + O O o o O O o O O O O O o . O o O O o O O O O O O o O o O O o +ooOooOoO o O `oO `OoO' o oOoO' o o' `OoO' `OoO' OOoOooO o' `OoO' `OoO' o O `OoO' `OoO' `OoO' O o `OoO' oOoO' `OoO' o `oO + O O + o' o' \ No newline at end of file diff --git a/cmd/root.go b/cmd/root.go index 4118f17..5cb2a8f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -4,6 +4,7 @@ Copyright © 2023 NAME HERE package cmd import ( + _ "embed" "os" "github.com/spf13/cobra" @@ -18,6 +19,9 @@ const ( repositoryFlagName = "repository" ) +//go:embed banner.txt +var banner []byte + // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ Use: "enterprise-licenses-report", @@ -38,6 +42,11 @@ func Execute() { } func init() { + rootCmd.SetOut(os.Stdout) + rootCmd.SetErr(os.Stderr) + rootCmd.Version = VERSION + rootCmd.Println("\n\n" + string(banner) + "\n\n") + // Here you will define your flags and configuration settings. // Cobra supports persistent flags, which, if defined here, // will be global for your application. diff --git a/main.go b/main.go index 332f551..5fda799 100644 --- a/main.go +++ b/main.go @@ -1,5 +1,5 @@ /* -Copyright © 2023 NAME HERE +Copyright © 2023 @gateixeira */ package main