Skip to content

Commit

Permalink
chore: update GitHub Actions and Goreleaser configurations
Browse files Browse the repository at this point in the history
- Add a new file `.github/workflows/dev.yml`
- Modify `GO_VERSION` from `1.21` to `1.22` in `.github/workflows/test.yml`
- Add a new file `.goreleaser.dev.yaml`
- Modify `prerelease` from `auto` to `true` in `.goreleaser.yaml`

Signed-off-by: ysicing <[email protected]>
  • Loading branch information
ysicing committed Feb 26, 2024
1 parent 92d8f42 commit 4adda10
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 89 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Dev Release

on:
push:
branches:
- '*'
paths:
- '**.go'
- 'go.mod'
- '.github/**'

env:
TZ: Asia/Shanghai
GO_VERSION: '1.22'

permissions: write-all

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
- name: install task
run: |
echo "install task"
go install github.com/go-task/task/v3/cmd/task@latest
- name: install upx
uses: crazy-max/ghaction-upx@v3
with:
install-only: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release -f .goreleaser.dev.yaml --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}


2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: build for test

env:
# Common versions
GO_VERSION: '1.21'
GO_VERSION: '1.22'
TZ: Asia/Shanghai

permissions: write-all
Expand Down
67 changes: 67 additions & 0 deletions .goreleaser.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
project_name: qcadmin

env:
- GO111MODULE=on

before:
hooks:
- task generate
- ./hack/scripts/gencompletions.sh
- ./hack/scripts/genmanpages.sh

builds:
- ldflags:
- -w -s -X github.com/easysoft/qcadmin/common.Version={{.Summary}}
- -X github.com/easysoft/qcadmin/common.BuildDate={{.CommitDate}}
- -X github.com/easysoft/qcadmin/common.GitCommitHash={{.ShortCommit}}
- -X k8s.io/client-go/pkg/version.gitVersion={{.Summary}}
- -X k8s.io/client-go/pkg/version.gitCommit={{.FullCommit}}
- -X k8s.io/client-go/pkg/version.gitTreeState=dirty
- -X k8s.io/client-go/pkg/version.buildDate={{.CommitDate}}
- -X k8s.io/client-go/pkg/version.gitMajor=1
- -X k8s.io/client-go/pkg/version.gitMinor=24
- -X k8s.io/component-base/version.gitVersion={{.Summary}}
- -X k8s.io/component-base/version.gitCommit={{.FullCommit}}
- -X k8s.io/component-base/version.gitTreeState=dirty
- -X k8s.io/component-base/version.gitMajor=1
- -X k8s.io/component-base/version.gitMinor=24
- -X k8s.io/component-base/version.buildDate={{.CommitDate}}
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
main: main.go
id: qcadmin
binary: qcadmin

archives:
- format: binary
name_template: "qcadmin_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"

checksum:
name_template: 'checksums.txt'

snapshot:
name_template: "{{ .Version }}-snapshot-{{ .ShortCommit }}"

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- '^feat(ci):'
- '^chore(ci):'
- '^chore(action):'
- '^Merge remote'

release:
prerelease: auto
replace_existing_draft: true
mode: replace
make_latest: false
draft: true
89 changes: 1 addition & 88 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,93 +50,6 @@ checksum:
snapshot:
name_template: "{{ .Version }}-snapshot-{{ .ShortCommit }}"

nfpms:
- file_name_template: 'qcadmin_{{ .Tag }}_{{ .Os }}_{{ .Arch }}'
builds:
- qcadmin
package_name: qcadmin
priority: optional
vendor: https://github.com/easysoft/quickon_cli
homepage: https://www.qucheng.com
version_metadata: git
description: |-
Cloud Native application delivery platform cli
maintainer: easysoft
license: AGPL-3.0
formats:
- deb
- rpm
bindir: /usr/bin
section: utils
contents:
- src: ./completions/q.bash
dst: /usr/share/bash-completion/completions/q
file_info:
mode: 0644
owner: notRoot
group: notRoot
- src: ./completions/q.fish
dst: /usr/share/fish/completions/q.fish
file_info:
mode: 0644
owner: notRoot
group: notRoot
- src: ./completions/q.zsh
dst: /usr/share/zsh/vendor-completions/_q
file_info:
mode: 0644
owner: notRoot
group: notRoot
- src: ./manpages/q.1.gz
dst: /usr/share/man/man1/q.1.gz
file_info:
mode: 0644
owner: notRoot
group: notRoot
- src: ./LICENSE.md
dst: /usr/share/doc/q/copyright
file_info:
mode: 0644
owner: notRoot
group: notRoot
- src: ./completions/qcadmin.bash
dst: /usr/share/bash-completion/completions/qcadmin
file_info:
mode: 0644
owner: notRoot
group: notRoot
- src: ./completions/qcadmin.fish
dst: /usr/share/fish/completions/qcadmin.fish
file_info:
mode: 0644
owner: notRoot
group: notRoot
- src: ./completions/qcadmin.zsh
dst: /usr/share/zsh/vendor-completions/_qcadmin
file_info:
mode: 0644
owner: notRoot
group: notRoot
- src: ./manpages/qcadmin.1.gz
dst: /usr/share/man/man1/qcadmin.1.gz
file_info:
mode: 0644
owner: notRoot
group: notRoot
- src: ./LICENSE.md
dst: /usr/share/doc/qcadmin/copyright
file_info:
mode: 0644
owner: notRoot
group: notRoot
- dst: /root/.qc
type: dir
scripts:
preinstall: ./hack/packaging/preinstall.sh
postinstall: ./hack/packaging/postinstall.sh
preremove: ./hack/packaging/preremove.sh
postremove: ./hack/packaging/postremove.sh

changelog:
sort: asc
filters:
Expand All @@ -149,6 +62,6 @@ changelog:
- '^Merge remote'

release:
prerelease: auto
prerelease: "true"
replace_existing_draft: true
mode: replace

0 comments on commit 4adda10

Please sign in to comment.