Merge pull request #7 from kongfei605/main

github action publish
This commit is contained in:
kongfei605 2022-06-05 20:15:35 +08:00 committed by GitHub
commit 0e39b6391b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 89 additions and 1 deletions

17
.github/dependentbot.yaml vendored Normal file
View File

@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"

28
.github/workflows/release.yaml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Release
on:
push:
tags:
- 'v*'
env:
GO_VERSION: 1.18
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go Environment
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

43
.goreleaser.yaml Normal file
View File

@ -0,0 +1,43 @@
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
snapshot:
name_template: '{{ .Tag }}'
checksum:
name_template: 'checksums.txt'
changelog:
skip: true
builds:
- id: build
main: ./
binary: categraf
env:
- CGO_ENABLED=1
goos:
- linux
- windows
goarch:
- amd64
ldflags:
- -s -w
- -X flashcat.cloud/categraf/config.Version={{ .Tag }}-{{.Commit}}
archives:
- id: categraf
format: tar.gz
format_overrides:
- goos: windows
format: zip
name_template: "{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}"
wrap_in_directory: true
files:
- conf/*
release:
github:
owner: kongfei605
name: categraf
name_template: "{{ .ProjectName }}-v{{ .Version }}"

View File

@ -19,7 +19,7 @@ build:
build-linux:
echo "Building version $(GIT_VERSION) for linux"
CGO_ENABLE=1 GOOS=linux GOARCH=amd64 go build -ldflags $(LDFLAGS) -o $(APP)
GOOS=linux GOARCH=amd64 go build -ldflags $(LDFLAGS) -o $(APP)
build-windows:
echo "Building version $(GIT_VERSION) for windows"