Skip to content

Commit

Permalink
fix: fix cicd build project
Browse files Browse the repository at this point in the history
  • Loading branch information
cubxxw committed Mar 16, 2024
1 parent 7c64188 commit 39673cc
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 182 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Go environment
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.20

- name: Set up Git
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.18
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: '1.18'
go-version: '1.20'
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
Expand Down
60 changes: 0 additions & 60 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,63 +63,3 @@ jobs:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
USERNAME: ${{ github.repository_owner }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}

gorelease2:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
with:
fetch-depth: 0
- uses: arduino/setup-task@e26d8975574116b0097a1161e0fe16ba75d84c1c # v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2
- uses: docker/setup-buildx-action@2a1a44ac4aa01993040736bd95bb470da1a38365 # v2
- name: setup-snapcraft
# FIXME: the mkdirs are a hack for https://github.com/goreleaser/goreleaser/issues/1715
run: |
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
mkdir -p $HOME/.cache/snapcraft/download
mkdir -p $HOME/.cache/snapcraft/stage-packages
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4
with:
go-version: stable
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
with:
path: |
./_output/dist/*.deb
./_output/dist/*.rpm
key: ${{ github.ref }}
- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected]
- uses: crazy-max/ghaction-upx@v2
with:
install-only: true
- uses: cachix/install-nix-action@v22
with:
github_access_token: ${{ secrets.BOT_GITHUB_TOKEN }}
- name: dockerhub-login
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: ghcr-login
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.BOT_GITHUB_TOKEN }}
- name: snapcraft-login
if: startsWith(github.ref, 'refs/tags/v')
run: snapcraft login --with <(echo "${{ secrets.SNAPCRAFT_TOKEN }}")
- name: goreleaser-release
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
run: task goreleaser
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ linters-settings:
simplify: true

gofumpt:
# Select the Go version to target. The default is `1.18`.
# Select the Go version to target. The default is `1.20`.
lang-version: "1.20"

# Choose whether or not to use the extra rules that are disabled
Expand Down
114 changes: 3 additions & 111 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ archives:
nfpms:
- id: packages
builds:
- syncer
- cld
# Your app's vendor.
vendor: kubecub
homepage: https://github.com/kubecub/comment-lang-detector
maintainer: kubbot <https://github.com/kubbot>
description: |-
Auto sync github labels
Comment Lang Detector is a tool to detect the language of comments in code files.
Kubecub && cubxxw
license: MIT
formats:
Expand Down Expand Up @@ -213,118 +213,10 @@ checksum:
name_template: "{{ .ProjectName }}_checksums.txt"
algorithm: sha256

# dockers:
# - use: buildx
# ids:
# - syncer
# goos: linux
# goarch: amd64
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-amd64
# dockerfile: deploy/syncer/Dockerfile.syncer
# build_flag_templates:
# - --pull
# - --platform=linux/amd64
# - --label=io.syncer.image.created={{.Date}}
# - --label=io.syncer.image.title=syncer
# - --label=io.syncer.image.revision={{.ShortCommit}}
# - --label=io.syncer.image.version={{.Tag }}
# - --label=io.syncer.image.auth={{ .Env.USERNAME }}

# - use: buildx
# ids:
# - syncer
# goos: linux
# goarch: arm64
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-amd64
# dockerfile: docker/syncer/Dockerfile.syncer
# build_flag_templates:
# - --pull
# - --platform=linux/amd64
# - --label=io.syncer.image.created={{.Date}}
# - --label=io.syncer.image.title=syncer
# - --label=io.syncer.image.revision={{.ShortCommit}}
# - --label=io.syncer.image.version={{.Tag }}
# - --label=io.syncer.image.auth={{ .Env.USERNAME }}

# - use: buildx
# ids:
# - cld
# goos: linux
# goarch: amd64
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }}-amd64
# dockerfile: deploy/cld/Dockerfile.cld
# build_flag_templates:
# - --pull
# - --platform=linux/amd64
# - --label=io.cld.image.created={{.Date}}
# - --label=io.cld.image.title=cld
# - --label=io.cld.image.revision={{.ShortCommit}}
# - --label=io.cld.image.version={{.Tag }}
# - --label=io.cld.image.auth={{ .Env.USERNAME }}

# - use: buildx
# ids:
# - cld
# goos: linux
# goarch: arm64
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }}-arm64
# dockerfile: docker/cld/Dockerfile.cld
# build_flag_templates:
# - --pull
# - --platform=linux/arm64
# - --label=io.cld.image.created={{.Date}}
# - --label=io.cld.image.title=cld
# - --label=io.cld.image.revision={{.ShortCommit}}
# - --label=io.cld.image.version={{.Tag }}
# - --label=io.cld.image.auth={{ .Env.USERNAME }}


# docker_manifests:
# - name_template: ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }}
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }}-amd64
# - ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }}-arm64
# - name_template: ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-amd64
# - ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-arm64

# - name_template: ghcr.io/{{ .Env.USERNAME }}/cld:latest
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }}-amd64
# - ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }}-arm64
# - name_template: ghcr.io/{{ .Env.USERNAME }}/syncer:latest
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-amd64
# - ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-arm64

# docker_signs:
# - cmd: cosign
# artifacts: manifests
# output: true
# args:
# - "sign"
# - "${artifact}@${digest}"
# - --yes

release:
footer: |
**Full Changelog**: https://github.com/kubecub/goreleaser/compare/{{ .PreviousTag }}...{{ .Tag }}
**Full Changelog**: https://github.com/kubecub/comment-lang-detector/compare/{{ .PreviousTag }}...{{ .Tag }}
## Helping out
This release is only possible thanks to **all** the support of some **awesome people**!
Want to be one of them?
You can [sponsor](https://goreleaser.com/sponsors/), get a [Pro License](https://goreleaser.com/pro) or [contribute with code](https://goreleaser.com/contributing).
## Where to go next?
* Find examples and commented usage of all options in our [website](https://goreleaser.com/intro/).
* Reach out on [Discord](https://discord.gg/RGEBtg8vQ6) and [Twitter](https://twitter.com/goreleaser)!
<a href="https://goreleaser.com"><img src="https://raw.githubusercontent.com/goreleaser/artwork/master/opencollective-header.png" with="100%" alt="GoReleaser logo"></a>
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
- more feature
- branch save
- labels sync
- syncer docker file
- test labels
- test labels
- test labels
Expand Down
12 changes: 6 additions & 6 deletions scripts/install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,20 @@ function iam::install::init_into_go_env()
# Go 编译环境安装和配置
function iam::install::go_command()
{
rm -rf /tmp/go1.18.3.linux-amd64.tar.gz $HOME/go/go1.18.3 # clean up
rm -rf /tmp/go1.20.3.linux-amd64.tar.gz $HOME/go/go1.20.3 # clean up

# 1. 下载 go1.18.3 版本的 Go 安装包
wget -P /tmp/ https://golang.google.cn/dl/go1.18.3.linux-amd64.tar.gz
# 1. 下载 go1.20.3 版本的 Go 安装包
wget -P /tmp/ https://golang.google.cn/dl/go1.20.3.linux-amd64.tar.gz

# 2. 安装 Go
mkdir -p $HOME/go
tar -xvzf /tmp/go1.18.3.linux-amd64.tar.gz -C $HOME/go
mv $HOME/go/go $HOME/go/go1.18.3
tar -xvzf /tmp/go1.20.3.linux-amd64.tar.gz -C $HOME/go
mv $HOME/go/go $HOME/go/go1.20.3

# 3. 配置 Go 环境变量
cat << 'EOF' >> $HOME/.bashrc
# Go envs
export GOVERSION=go1.18.3 # Go 版本设置
export GOVERSION=go1.20.3 # Go 版本设置
export GO_INSTALL_DIR=$HOME/go # Go 安装目录
export GOROOT=$GO_INSTALL_DIR/$GOVERSION # GOROOT 设置
export GOPATH=$WORKSPACE/golang # GOPATH 设置
Expand Down

0 comments on commit 39673cc

Please sign in to comment.