-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: cuisongliu <cuisongliu@qq.com>
- Loading branch information
1 parent
05c47d9
commit fde3c4d
Showing
47 changed files
with
3,996 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
version: v1 | ||
debug: true | ||
type: action | ||
action: | ||
printConfig: true | ||
release: | ||
retry: 15s | ||
actionName: Release | ||
allowOps: | ||
- cuisongliu | ||
bot: | ||
prefix: / | ||
spe: _ | ||
allowOps: | ||
- sealos-ci-robot | ||
- sealos-release-robot | ||
email: sealos-ci-robot@sealos.io | ||
username: sealos-ci-robot | ||
repo: | ||
org: false | ||
|
||
message: | ||
success: | | ||
🤖 says: Hooray! The action {{.Body}} has been completed successfully. 🎉 | ||
format_error: | | ||
🤖 says: ‼️ There is a formatting issue with the action, kindly verify the action's format. | ||
permission_error: | | ||
🤖 says: ‼️ The action doesn't have permission to trigger. | ||
release_error: | | ||
🤖 says: ‼️ Release action failed. | ||
Error details: {{.Error}} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Github Rebot | ||
on: | ||
issue_comment: | ||
types: | ||
- created | ||
env: | ||
GH_TOKEN: "${{ secrets.GH_PAT }}" | ||
GH_REBOT_VERSION: "v0.0.5" | ||
jobs: | ||
comment: | ||
if: startswith(github.event.comment.body, '/') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the latest code | ||
uses: actions/checkout@v3 | ||
- name: Gh Rebot for Sealos | ||
uses: labring/gh-rebot@v0.0.6 | ||
with: | ||
version: v0.0.7-rc1 | ||
env: | ||
SEALOS_TYPE: "/comment" | ||
GH_TOKEN: "${{ secrets.GH_PAT }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: GO | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "*" ] | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.20.x | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v1 | ||
with: | ||
version: latest | ||
args: build --snapshot --clean --timeout=1h | ||
- name: Copy file | ||
run: | | ||
cp dist/sreg_linux_amd64_v1/sreg sreg | ||
chmod a+x sreg | ||
sreg version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- '**' | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.20.x | ||
|
||
- name: Get previous tag | ||
id: previoustag | ||
run: | | ||
PREVIOUS_TAG=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) | ||
echo "PREVIOUS_TAG=$PREVIOUS_TAG" >> $GITHUB_OUTPUT | ||
- name: Display previous tag | ||
run: | | ||
echo "Previous tag: ${{ steps.previoustag.outputs.PREVIOUS_TAG }}" | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@master | ||
with: | ||
go-version: 1.20.x | ||
- name: Prepare | ||
id: prepare | ||
run: | | ||
TAG=${GITHUB_REF#refs/tags/} | ||
echo tag_name=${TAG} >> $GITHUB_OUTPUT | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
args: release --timeout=1h --debug | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_PAT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
before: | ||
hooks: | ||
# You may remove this if you don't use go modules. | ||
- go mod download | ||
# you may remove this if you don't need go generate | ||
- go generate ./... | ||
builds: | ||
- id: gh-rebot | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
ldflags: | ||
- -s -w | ||
- -X github.com/labring/sreg/pkg/version.gitVersion={{.Version}} | ||
- -X github.com/labring/sreg/pkg/version.gitCommit={{.ShortCommit}} | ||
- -X github.com/labring/sreg/pkg/version.buildDate={{.Date}} | ||
|
||
|
||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ .Tag }}-next" | ||
changelog: | ||
sort: asc | ||
use: github | ||
filters: | ||
exclude: | ||
- '^test:' | ||
- '^chore' | ||
- 'merge conflict' | ||
- Merge pull request | ||
- Merge remote-tracking branch | ||
- Merge branch | ||
- go mod tidy | ||
groups: | ||
- title: Dependency updates | ||
regexp: '^.*?(feat|fix)\(deps\)!?:.+$' | ||
order: 300 | ||
- title: 'New Features' | ||
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$' | ||
order: 100 | ||
- title: 'Security updates' | ||
regexp: '^.*?sec(\([[:word:]]+\))??!?:.+$' | ||
order: 150 | ||
- title: 'Bug fixes' | ||
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$' | ||
order: 200 | ||
- title: 'Documentation updates' | ||
regexp: ^.*?doc(\([[:word:]]+\))??!?:.+$ | ||
order: 400 | ||
- title: 'Build process updates' | ||
regexp: ^.*?build(\([[:word:]]+\))??!?:.+$ | ||
order: 400 | ||
- title: Other work | ||
order: 9999 | ||
|
||
release: | ||
prerelease: auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright © 2021 sealos. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"github.com/labring/sreg/pkg/registry/commands" | ||
"github.com/labring/sreg/pkg/utils/logger" | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
debug bool | ||
) | ||
|
||
// rootCmd represents the base command when called without any subcommands | ||
var rootCmd = &cobra.Command{ | ||
Use: "sreg", | ||
Short: "sealos registry related", | ||
// Uncomment the following line if your bare application | ||
// has an action associated with it: | ||
// Run: func(cmd *cobra.Command, args []string) { }, | ||
} | ||
|
||
// Execute adds all child commands to the root command and sets flags appropriately. | ||
// This is called by main.main(). It only needs to happen once to the rootCmd. | ||
func Execute() { | ||
if err := rootCmd.Execute(); err != nil { | ||
if rootCmd.SilenceErrors { | ||
fmt.Fprintln(os.Stderr, err) | ||
} | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func init() { | ||
cobra.OnInitialize(func() { | ||
logger.CfgConsoleLogger(debug, false) | ||
}) | ||
rootCmd.PersistentFlags().BoolVar(&debug, "debug", false, "enable debug logger") | ||
|
||
} | ||
|
||
func init() { | ||
examplePrefix := rootCmd.Name() | ||
rootCmd.AddCommand(commands.NewServeRegistryCommand()) | ||
rootCmd.AddCommand(commands.NewRegistryImageSaveCmd(examplePrefix)) | ||
rootCmd.AddCommand(commands.NewSyncRegistryCommand(examplePrefix)) | ||
rootCmd.AddCommand(commands.NewCopyRegistryCommand(examplePrefix)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright © 2021 sealos. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package cmd | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"github.com/labring/sreg/pkg/version" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var shortPrint bool | ||
|
||
func newVersionCmd() *cobra.Command { | ||
var versionCmd = &cobra.Command{ | ||
Use: "version", | ||
Short: "version", | ||
Args: cobra.NoArgs, | ||
Example: `sealctl version`, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
marshalled, err := json.Marshal(version.Get()) | ||
if err != nil { | ||
return err | ||
} | ||
if shortPrint { | ||
fmt.Println(version.Get().String()) | ||
} else { | ||
fmt.Println(string(marshalled)) | ||
} | ||
return nil | ||
}, | ||
} | ||
versionCmd.Flags().BoolVar(&shortPrint, "short", false, "if true, print just the version number.") | ||
return versionCmd | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(newVersionCmd()) | ||
} |
Oops, something went wrong.