Skip to content

Commit

Permalink
chore: update .gitignore and enhance auto-tag workflow with cleanup s…
Browse files Browse the repository at this point in the history
…teps

- Added Go workspace and cache directories to .gitignore to prevent unnecessary files from being tracked.
- Introduced a cleanup step in the auto-tag workflow to remove temporary Go directories and cached files, improving workspace management.
- Updated GOPATH, GOCACHE, and GOMODCACHE paths in the workflow to use temporary directories for better isolation during builds.
  • Loading branch information
yuaotian committed Dec 30, 2024
1 parent dc77615 commit 397e9d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/auto-tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,6 @@ jobs:
exit 1
fi
# 添加 Go 工作目录设置
- name: Set Go Work Directory
run: |
echo "GOPATH=${{ github.workspace }}/go" >> $GITHUB_ENV
echo "${{ github.workspace }}/go/bin" >> $GITHUB_PATH
# 添加依赖检查步骤
- name: Check Dependencies
run: |
Expand All @@ -157,6 +151,15 @@ jobs:
echo "GOARCH=${GOARCH:-$(go env GOARCH)}" >> $GITHUB_ENV
echo "GO111MODULE=on" >> $GITHUB_ENV
# 添加清理步骤
- name: Cleanup workspace
run: |
rm -rf /tmp/go/
rm -rf .cache/
rm -rf dist/
git clean -fdx
git status
# 修改 GoReleaser 步骤
- name: Run GoReleaser
if: ${{ startsWith(github.ref, 'refs/tags/v') || (success() && steps.get_latest_tag.outputs.version != '') }}
Expand All @@ -169,10 +172,10 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.get_latest_tag.outputs.version }}
CGO_ENABLED: 0
GOPATH: ${{ github.workspace }}/go
GOPATH: /tmp/go
GOROOT: ${{ env.GOROOT }}
GOCACHE: ${{ github.workspace }}/.cache/go-build
GOMODCACHE: ${{ github.workspace }}/go/pkg/mod
GOCACHE: /tmp/.cache/go-build
GOMODCACHE: /tmp/go/pkg/mod
GORELEASER_DEBUG: 1
GORELEASER_CURRENT_TAG: ${{ steps.get_latest_tag.outputs.version }}
# 添加额外的构建信息
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ dist/

# Go specific
go.sum
go/
.cache/

# IDE and editor files
.vscode/
Expand Down

0 comments on commit 397e9d9

Please sign in to comment.