Skip to content

Commit

Permalink
ci: 处理缓存导致的版本号错乱的问题,gocq使用自己仓库的hash作为版本号 (#16)
Browse files Browse the repository at this point in the history
* ci: 缓存core会导致版本号错乱,移除

* ci: gocq的版本号使用它自己仓库的hash
  • Loading branch information
JustAnotherID authored Sep 7, 2023
1 parent d485cee commit 38ca225
Showing 1 changed file with 1 addition and 56 deletions.
57 changes: 1 addition & 56 deletions .github/workflows/auto-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
run: |
if [ $GOOS = "windows" ]; then export BINARY_SUFFIX=".exe"; fi
export BINARY_NAME="go-cqhttp$BINARY_SUFFIX"
export LD_FLAGS="-w -s -X github.com/Mrs4s/go-cqhttp/internal/base.Version=${COMMIT_ID::7}-sealdicefork"
export LD_FLAGS="-w -s -X github.com/Mrs4s/go-cqhttp/internal/base.Version=${GOCQ_CID::7}-sealdicefork"
go build -o "output/$BINARY_NAME" -trimpath -ldflags "$LD_FLAGS" .
- name: Upload Gocqhttp
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -234,33 +234,16 @@ jobs:
- name: Install Cross-compiler for Linux Arm64
if: matrix.goos == 'linux' && matrix.goarch == 'arm64'
run: sudo apt-get -y install gcc-aarch64-linux-gnu
- name: Get Commit ID
run: |
cd sealdice-core
echo "CORE_CID=`git rev-parse HEAD`" >> $GITHUB_ENV;
cd ../sealdice-ui
echo "UI_CID=`git rev-parse HEAD`" >> $GITHUB_ENV;
- name: Cache Core dist get
id: cache-core-dist
uses: actions/cache@v3
env:
cache-name: cache-core-${{ matrix.goos }}-${{ matrix.goarch }}-dist
with:
path: ./sealdice-core/output
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.CORE_CID }}${{ env.UI_CID }}
- name: Install Go
if: ${{ steps.cache-core-dist.outputs.cache-hit != 'true' }}
uses: actions/setup-go@v3
with:
go-version: stable
- name: Install Dependencies
if: ${{ steps.cache-core-dist.outputs.cache-hit != 'true' }}
working-directory: ./sealdice-core
run: |
go mod tidy
go get .
- name: Get UI Resources
if: ${{ steps.cache-core-dist.outputs.cache-hit != 'true' }}
uses: actions/download-artifact@v3
with:
name: sealdice-ui
Expand All @@ -287,7 +270,6 @@ jobs:
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV;
fi
- name: Build Binary
if: ${{ steps.cache-core-dist.outputs.cache-hit != 'true' }}
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
Expand Down Expand Up @@ -317,33 +299,16 @@ jobs:
uses: actions/checkout@v3
with:
submodules: true
- name: Get Commit ID
run: |
cd sealdice-core
echo "CORE_CID=`git rev-parse HEAD`" >> $GITHUB_ENV;
cd ../sealdice-ui
echo "UI_CID=`git rev-parse HEAD`" >> $GITHUB_ENV;
- name: Cache Core dist get
id: cache-core-dist
uses: actions/cache@v3
env:
cache-name: cache-core-${{ matrix.goos }}-${{ matrix.goarch }}-dist
with:
path: ./sealdice-core/output
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.CORE_CID }}${{ env.UI_CID }}
- name: Install Go
if: ${{ steps.cache-core-dist.outputs.cache-hit != 'true' }}
uses: actions/setup-go@v3
with:
go-version: stable
- name: Install dependencies
if: ${{ steps.cache-core-dist.outputs.cache-hit != 'true' }}
working-directory: ./sealdice-core
run: |
go mod tidy
go get .
- name: Get UI Resources
if: ${{ steps.cache-core-dist.outputs.cache-hit != 'true' }}
uses: actions/download-artifact@v3
with:
name: sealdice-ui
Expand All @@ -352,7 +317,6 @@ jobs:
working-directory: ./sealdice-core
run: echo "PROJECT_VERSION=dev-${COMMIT_ID::7}" >> $GITHUB_ENV;
- name: Build Binary
if: ${{ steps.cache-core-dist.outputs.cache-hit != 'true' }}
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
Expand All @@ -376,41 +340,23 @@ jobs:
uses: actions/checkout@v3
with:
submodules: true
- name: Get Commit ID
run: |
cd sealdice-core
echo "CORE_CID=`git rev-parse HEAD`" >> $GITHUB_ENV;
cd ../sealdice-ui
echo "UI_CID=`git rev-parse HEAD`" >> $GITHUB_ENV;
- name: Cache Core dist get
id: cache-core-dist
uses: actions/cache@v3
env:
cache-name: cache-corea-dist
with:
path: ./sealdice-core/output
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.CORE_CID }}${{ env.UI_CID }}
- name: Setup Android NDK
if: ${{ steps.cache-core-dist.outputs.cache-hit != 'true' }}
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: ${{ env.ANDROID_NDK_VERSION }}
link-to-sdk: true
local-cache: true
- name: Install Go
if: ${{ steps.cache-core-dist.outputs.cache-hit != 'true' }}
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Install dependencies
if: ${{ steps.cache-core-dist.outputs.cache-hit != 'true' }}
working-directory: ./sealdice-core
run: |
go mod tidy
go get .
- name: Get UI Resources
if: ${{ steps.cache-core-dist.outputs.cache-hit != 'true' }}
uses: actions/download-artifact@v3
with:
name: sealdice-ui
Expand All @@ -419,7 +365,6 @@ jobs:
run: |
echo "PROJECT_VERSION=dev-${COMMIT_ID::7}" >> $GITHUB_ENV;
- name: Build binary
if: ${{ steps.cache-core-dist.outputs.cache-hit != 'true' }}
env:
GOOS: android
GOARCH: arm64
Expand Down

0 comments on commit 38ca225

Please sign in to comment.