chore: bump submodules #787
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Build | |
on: | |
# schedule: | |
# # 每天 UTC 12:00(即北京时间 20:00)自动执行 | |
# - cron: '0 12 * * *' | |
push: | |
branches: | |
- dev | |
workflow_dispatch: | |
env: | |
ANDROID_NDK_VERSION: r25c | |
COMMIT_ID: "${{ github.sha }}" | |
NO_BUILD_PROMPT: "no new commits, no need to build." | |
NT_SIGN_URL: ${{ secrets.NT_SIGN_URL }} | |
jobs: | |
commit-num-check: | |
name: Check Commit Num | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get New Commits | |
id: get-commits | |
run: echo "NEW_COMMIT_COUNT=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_OUTPUT | |
- name: Get Commit IDs | |
id: get-commit-ids | |
run: | | |
echo "UI_CID=`cd sealdice-ui && git rev-parse HEAD`" >> $GITHUB_OUTPUT; | |
echo "CORE_CID=`cd sealdice-core && git rev-parse HEAD`" >> $GITHUB_OUTPUT; | |
echo "ANDROID_VERSION=`cd sealdice-android && git describe --tags --abbrev=0`" >> $GITHUB_OUTPUT; | |
- name: Warning | |
run: if [ $(git log --oneline --since '24 hours ago' | wc -l) <= 0 ]; then echo $NO_BUILD_PROMPT; fi | |
outputs: | |
commit-count: ${{ steps.get-commits.outputs.NEW_COMMIT_COUNT }} | |
CORE_CID: ${{ steps.get-commit-ids.outputs.CORE_CID }} | |
UI_CID: ${{ steps.get-commit-ids.outputs.UI_CID }} | |
ANDROID_VERSION: ${{ steps.get-commit-ids.outputs.ANDROID_VERSION }} | |
PROJECT_VERSION: ${{ steps.get-version.outputs.PROJECT_VERSION }} | |
resources-download: | |
name: Download Related Resources | |
runs-on: ubuntu-latest | |
needs: commit-num-check | |
if: ${{ needs.commit-num-check.outputs.commit-count > 0 }} | |
steps: | |
- name: Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Upload Documents | |
uses: actions/upload-artifact@v4 | |
with: | |
name: documents | |
path: ./sealdice-builtins/data | |
lagrange-download: | |
name: Download Lagrange | |
runs-on: ubuntu-latest | |
needs: commit-num-check | |
if: ${{ needs.commit-num-check.outputs.commit-count > 0 }} | |
steps: | |
- name: Download | |
run: | | |
mkdir lag | |
curl https://d1.sealdice.com/lagrange/0.0.5/Lagrange.OneBot_linux-arm64_7.0.zip?v=2 > lag/Lagrange.OneBot.linux-arm64.zip | |
curl https://d1.sealdice.com/lagrange/0.0.5/Lagrange.OneBot_linux-x64_7.0.zip?v=2 > lag/Lagrange.OneBot.linux-amd64.zip | |
curl https://d1.sealdice.com/lagrange/0.0.5/Lagrange.OneBot_win-x64_7.0.zip?v=2 > lag/Lagrange.OneBot.windows-amd64.zip | |
curl https://d1.sealdice.com/lagrange/0.0.5/Lagrange.OneBot_win-x86_7.0.zip?v=2 > lag/Lagrange.OneBot.windows-386.zip | |
curl https://d1.sealdice.com/lagrange/0.0.5/Lagrange.OneBot_osx-arm64_7.0.zip?v=2 > lag/Lagrange.OneBot.darwin-arm64.zip | |
curl https://d1.sealdice.com/lagrange/0.0.5/Lagrange.OneBot_osx-x64_7.0.zip?v=2 > lag/Lagrange.OneBot.darwin-amd64.zip | |
curl https://d1.sealdice.com/lagrange/0.0.5/Lagrange.OneBot_linux-musl-arm64_7.0.zip?v=2 > lag/Lagrange.OneBot.android-arm64.zip | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lagrange | |
path: ./lag | |
lagrange-gocq-download: | |
name: Download Lagrange-Gocq | |
runs-on: ubuntu-latest | |
needs: commit-num-check | |
if: ${{ needs.commit-num-check.outputs.commit-count > 0 }} | |
steps: | |
- name: Download | |
run: | | |
mkdir lag | |
curl https://d1.sealdice.com/go-cqhttp-largrange/0.0.1/lagrange-gocq.android-arm64.zip > lag/lagrange-gocq.android-arm64.zip | |
curl https://d1.sealdice.com/go-cqhttp-largrange/0.0.1/lagrange-gocq.linux-arm64.zip > lag/lagrange-gocq.linux-arm64.zip | |
curl https://d1.sealdice.com/go-cqhttp-largrange/0.0.1/lagrange-gocq.linux-amd64.zip > lag/lagrange-gocq.linux-amd64.zip | |
curl https://d1.sealdice.com/go-cqhttp-largrange/0.0.1/lagrange-gocq.windows-amd64.zip > lag/lagrange-gocq.windows-amd64.zip | |
curl https://d1.sealdice.com/go-cqhttp-largrange/0.0.1/lagrange-gocq.windows-386.zip > lag/lagrange-gocq.windows-386.zip | |
curl https://d1.sealdice.com/go-cqhttp-largrange/0.0.1/lagrange-gocq.darwin-arm64.zip > lag/lagrange-gocq.darwin-arm64.zip | |
curl https://d1.sealdice.com/go-cqhttp-largrange/0.0.1/lagrange-gocq.darwin-amd64.zip > lag/lagrange-gocq.darwin-amd64.zip | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lagrange-gocq | |
path: ./lag | |
lagrange-setup: | |
name: Download Lagrange | |
runs-on: ubuntu-latest | |
needs: lagrange-download | |
strategy: | |
matrix: | |
# target: linux/amd64, linux/arm64, windows/amd64, darwin/amd64, darwin/arm64 | |
goos: [ linux, windows, darwin, android ] | |
goarch: [ '386', amd64, arm64 ] | |
exclude: | |
- goos: linux | |
goarch: '386' | |
- goos: windows | |
goarch: arm64 | |
- goos: windows | |
goarch: '386' | |
- goos: darwin | |
goarch: '386' | |
- goos: android | |
goarch: amd64 | |
- goos: android | |
goarch: '386' | |
steps: | |
- name: Get Lagrange | |
uses: actions/download-artifact@v4 | |
with: | |
name: lagrange | |
path: ./lagrange | |
- name: Extract | |
run: | | |
mkdir extract | |
ls ./lagrange/Lagrange.OneBot.${{ matrix.goos }}-${{ matrix.goarch }}.zip | |
file ./lagrange/Lagrange.OneBot.${{ matrix.goos }}-${{ matrix.goarch }}.zip | |
unzip ./lagrange/Lagrange.OneBot.${{ matrix.goos }}-${{ matrix.goarch }}.zip -d ./extract/Lagrange.OneBot.${{ matrix.goos }}-${{ matrix.goarch }} | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lagrange.${{ matrix.goos }}-${{ matrix.goarch }} | |
path: ./extract/Lagrange.OneBot.${{ matrix.goos }}-${{ matrix.goarch }} | |
lagrange-gocq-setup: | |
name: Download Lagrange-Gocq | |
runs-on: ubuntu-latest | |
needs: lagrange-gocq-download | |
strategy: | |
matrix: | |
# target: linux/amd64, linux/arm64, windows/amd64, darwin/amd64, darwin/arm64 | |
goos: [ linux, windows, darwin, android ] | |
goarch: [ '386', amd64, arm64 ] | |
exclude: | |
- goos: linux | |
goarch: '386' | |
- goos: windows | |
goarch: arm64 | |
- goos: windows | |
goarch: '386' | |
- goos: darwin | |
goarch: '386' | |
- goos: android | |
goarch: amd64 | |
- goos: android | |
goarch: '386' | |
steps: | |
- name: Get Lagrange-Gocq | |
uses: actions/download-artifact@v4 | |
with: | |
name: lagrange-gocq | |
path: ./lagrange | |
- name: Extract | |
run: | | |
mkdir extract | |
ls ./lagrange/lagrange-gocq.${{ matrix.goos }}-${{ matrix.goarch }}.zip | |
file ./lagrange/lagrange-gocq.${{ matrix.goos }}-${{ matrix.goarch }}.zip | |
unzip ./lagrange/lagrange-gocq.${{ matrix.goos }}-${{ matrix.goarch }}.zip -d ./extract/lagrange-gocq.${{ matrix.goos }}-${{ matrix.goarch }} | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lagrange-gocq.${{ matrix.goos }}-${{ matrix.goarch }} | |
path: ./extract/lagrange-gocq.${{ matrix.goos }}-${{ matrix.goarch }} | |
ui-build: | |
name: Build UI | |
runs-on: ubuntu-latest | |
needs: commit-num-check | |
if: ${{ needs.commit-num-check.outputs.commit-count > 0 }} | |
steps: | |
- name: Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Get Commit ID | |
run: | | |
cd sealdice-ui | |
echo "UI_CID=`git rev-parse --short HEAD`" >> $GITHUB_ENV; | |
- name: Cache ui dist get | |
id: cache-ui-dist | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-ui-dist | |
with: | |
path: ./sealdice-ui/dist | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.UI_CID }} | |
- if: ${{ steps.cache-ui-dist.outputs.cache-hit == 'true' }} | |
name: Show cache | |
continue-on-error: true | |
run: ls ./sealdice-ui/dist | |
- name: Install Pnpm | |
uses: pnpm/action-setup@v4 | |
if: ${{ steps.cache-ui-dist.outputs.cache-hit != 'true' }} | |
with: | |
version: 9 | |
run_install: false | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
if: ${{ steps.cache-ui-dist.outputs.cache-hit != 'true' }} | |
with: | |
node-version: 20 | |
- name: Install Dependencies | |
if: ${{ steps.cache-ui-dist.outputs.cache-hit != 'true' }} | |
working-directory: ./sealdice-ui | |
run: pnpm install | |
- name: Build WebUI | |
if: ${{ steps.cache-ui-dist.outputs.cache-hit != 'true' }} | |
working-directory: ./sealdice-ui | |
run: pnpm run build | |
- name: Upload UI | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sealdice-ui | |
path: ./sealdice-ui/dist | |
core-build: | |
name: Build Core | |
runs-on: ubuntu-20.04 | |
needs: ui-build | |
strategy: | |
matrix: | |
# target: linux/amd64, linux/arm64, windows/amd64 | |
goos: [ linux, windows ] | |
goarch: [ '386', amd64, arm64 ] | |
exclude: | |
- goos: linux | |
goarch: '386' | |
- goos: windows | |
goarch: arm64 | |
- goos: windows | |
goarch: '386' | |
fail-fast: true | |
steps: | |
- name: Apt-get Update | |
run: sudo apt-get update | |
- name: Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install Cross-compiler for Windows | |
if: matrix.goos == 'windows' | |
run: sudo apt-get -y install mingw-w64 | |
- name: Install Cross-compiler for Linux Amd64 Musl | |
if: matrix.goos == 'linux' && matrix.goarch == 'amd64' | |
run: sudo apt-get -y install musl-tools | |
- name: Install Cross-compiler for Linux Arm64 Musl | |
if: matrix.goos == 'linux' && matrix.goarch == 'arm64' | |
run: | | |
curl -O https://musl.cc/aarch64-linux-musl-cross.tgz; | |
tar zxf aarch64-linux-musl-cross.tgz; | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
cache-dependency-path: sealdice-core/go.sum | |
# copy from https://github.com/MetaCubeX/mihomo/blob/0e228765fce4d709af1e672426dea5294e6b7544/.github/workflows/build.yml#L121-L141 | |
# modify from https://github.com/restic/restic/issues/4636#issuecomment-1896455557 | |
# this patch file only works on golang1.22.x | |
# that means after golang1.23 release it must be changed | |
# revert: | |
# 693def151adff1af707d82d28f55dba81ceb08e1: "crypto/rand,runtime: switch RtlGenRandom for ProcessPrng" | |
# 7c1157f9544922e96945196b47b95664b1e39108: "net: remove sysSocket fallback for Windows 7" | |
# 48042aa09c2f878c4faa576948b07fe625c4707a: "syscall: remove Windows 7 console handle workaround" | |
- name: Revert Golang1.22 commit for Windows7/8 | |
if: ${{ matrix.goos == 'windows' }} | |
run: | | |
cd $(go env GOROOT) | |
patch --verbose -R -p 1 < $GITHUB_WORKSPACE/.github/patch_go122/693def151adff1af707d82d28f55dba81ceb08e1.diff | |
patch --verbose -R -p 1 < $GITHUB_WORKSPACE/.github/patch_go122/7c1157f9544922e96945196b47b95664b1e39108.diff | |
patch --verbose -R -p 1 < $GITHUB_WORKSPACE/.github/patch_go122/48042aa09c2f878c4faa576948b07fe625c4707a.diff | |
- name: Install Dependencies | |
working-directory: ./sealdice-core | |
run: | | |
go mod tidy | |
go get . | |
- name: Get UI Resources | |
uses: actions/download-artifact@v4 | |
with: | |
name: sealdice-ui | |
path: ./sealdice-core/static/frontend | |
- name: Get current time | |
uses: Kaven-Universe/github-action-current-date-time@v1 | |
id: currentTime | |
with: | |
format: YYYYMMDD | |
timezone-offset: -480 | |
- name: Set Env | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
working-directory: ./sealdice-core | |
run: | | |
echo "PROJECT_VERSION_C=${CUR_TIME}-${COMMIT_ID::7}" >> $GITHUB_ENV; | |
if [ $GOOS = 'windows' ]; then | |
echo "BINARY_NAME=sealdice-core.exe" >> $GITHUB_ENV; | |
else | |
echo "BINARY_NAME=sealdice-core" >> $GITHUB_ENV; | |
fi | |
if [ $GOOS = 'windows' ] && [ $GOARCH = '386' ]; then | |
echo "CC=i686-w64-mingw32-gcc" >> $GITHUB_ENV; | |
elif [ $GOOS = 'windows' ] && [ $GOARCH = 'amd64' ]; then | |
echo "CC=x86_64-w64-mingw32-gcc" >> $GITHUB_ENV; | |
elif [ $GOOS = 'linux' ] && [ $GOARCH = 'amd64' ]; then | |
echo "CC=musl-gcc" >> $GITHUB_ENV; | |
elif [ $GOOS = 'linux' ] && [ $GOARCH = 'arm64' ]; then | |
echo "CC=$(readlink -f ../aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc)" >> $GITHUB_ENV; | |
fi | |
- name: Build Binary | |
if: matrix.goos != 'linux' | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
GO111MODULE: on | |
CGO_ENABLED: ${{ matrix.goos == 'windows' && 1 || 0 }} | |
CGO_FLAGS: -Werror=unused-variable -Werror=implicit-function-declaration -O2 -H=windowsgui | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
SEAL_TRUSTED_PRIVATE_KEY: ${{ secrets.SEAL_TRUSTED_PRIVATE_KEY }} | |
working-directory: ./sealdice-core | |
run: go build -o "output/$BINARY_NAME" -trimpath -ldflags "-s -w -X sealdice-core/dice.VERSION_PRERELEASE=-dev -X sealdice-core/dice.VERSION_BUILD_METADATA=+${CUR_TIME}.${COMMIT_ID::7} -X sealdice-core/dice.APP_CHANNEL=dev -X 'sealdice-core/dice.DefaultSignUrl=${NT_SIGN_URL}' -X 'sealdice-core/dice.SealTrustedClientPrivateKey=${SEAL_TRUSTED_PRIVATE_KEY}'" . | |
- name: Build Binary (linux musl) | |
if: matrix.goos == 'linux' | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
GO111MODULE: on | |
CGO_ENABLED: 1 | |
CGO_FLAGS: -Werror=unused-variable -Werror=implicit-function-declaration -O2 -H=windowsgui | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
SEAL_TRUSTED_PRIVATE_KEY: ${{ secrets.SEAL_TRUSTED_PRIVATE_KEY }} | |
working-directory: ./sealdice-core | |
run: go build -tags musl -o "output/$BINARY_NAME" -trimpath -ldflags "-s -w -linkmode external -extldflags '-static' -X sealdice-core/dice.VERSION_PRERELEASE=-dev -X sealdice-core/dice.VERSION_BUILD_METADATA=+${CUR_TIME}.${COMMIT_ID::7} -X sealdice-core/dice.APP_CHANNEL=dev -X 'sealdice-core/dice.DefaultSignUrl=${NT_SIGN_URL}' -X 'sealdice-core/dice.SealTrustedClientPrivateKey=${SEAL_TRUSTED_PRIVATE_KEY}'" . | |
- name: Run UPX | |
uses: crazy-max/ghaction-upx@v3 | |
with: | |
version: latest | |
files: ./sealdice-core/output/${{ env.BINARY_NAME }} | |
args: -9 -fq | |
- name: Upload Core | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sealdice-core_${{ env.PROJECT_VERSION_C }}_${{ matrix.goos }}_${{ matrix.goarch }} | |
path: ./sealdice-core/output | |
core-darwin-build: | |
name: Build Core | |
runs-on: macos-latest | |
needs: ui-build | |
strategy: | |
matrix: | |
# target: darwin/amd64 darwin/arm64 | |
goos: [ darwin ] | |
goarch: [ amd64, arm64 ] | |
fail-fast: true | |
steps: | |
- name: Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
cache-dependency-path: sealdice-core/go.sum | |
- name: Install dependencies | |
working-directory: ./sealdice-core | |
run: | | |
go mod tidy | |
go get . | |
- name: Get UI Resources | |
uses: actions/download-artifact@v4 | |
with: | |
name: sealdice-ui | |
path: ./sealdice-core/static/frontend | |
- name: Get current time | |
uses: Kaven-Universe/github-action-current-date-time@v1 | |
id: currentTime | |
with: | |
format: YYYYMMDD | |
timezone-offset: -480 | |
- name: Set Env | |
working-directory: ./sealdice-core | |
run: | | |
echo "PROJECT_VERSION_C=${CUR_TIME}-${COMMIT_ID::7}" >> $GITHUB_ENV; | |
env: | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
- name: Build Binary | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
GO111MODULE: on | |
CGO_ENABLED: 1 | |
CGO_FLAGS: -Werror=unused-variable -Werror=implicit-function-declaration -O2 -mmacosx-version-min=10.12 | |
CGO_CFLAGS: -mmacosx-version-min=10.12 | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
SEAL_TRUSTED_PRIVATE_KEY: ${{ secrets.SEAL_TRUSTED_PRIVATE_KEY }} | |
working-directory: ./sealdice-core | |
run: go build -o "output/sealdice-core" -trimpath -ldflags "-s -w -X sealdice-core/dice.VERSION_PRERELEASE=-dev -X sealdice-core/dice.VERSION_BUILD_METADATA=+${CUR_TIME}.${COMMIT_ID::7} -X sealdice-core/dice.APP_CHANNEL=dev -X 'sealdice-core/dice.DefaultSignUrl=${NT_SIGN_URL}' -X 'sealdice-core/dice.SealTrustedClientPrivateKey=${SEAL_TRUSTED_PRIVATE_KEY}'" . | |
- name: Upload Core | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sealdice-core_${{ env.PROJECT_VERSION_C }}_${{ matrix.goos }}_${{ matrix.goarch }} | |
path: ./sealdice-core/output | |
core-android-build: | |
name: Build Core (android, arm64) | |
runs-on: ubuntu-20.04 | |
needs: ui-build | |
steps: | |
- name: Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Android NDK | |
id: setup-ndk | |
uses: nttld/setup-ndk@v1 | |
with: | |
ndk-version: ${{ env.ANDROID_NDK_VERSION }} | |
link-to-sdk: true | |
local-cache: false | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
cache-dependency-path: sealdice-core/go.sum | |
- name: Install dependencies | |
working-directory: ./sealdice-core | |
run: | | |
go mod tidy | |
go get . | |
- name: Get UI Resources | |
uses: actions/download-artifact@v4 | |
with: | |
name: sealdice-ui | |
path: ./sealdice-core/static/frontend | |
- name: Get current time | |
uses: Kaven-Universe/github-action-current-date-time@v1 | |
id: currentTime | |
with: | |
format: YYYYMMDD | |
timezone-offset: -480 | |
- name: Set Env | |
working-directory: ./sealdice-core | |
run: | | |
echo "PROJECT_VERSION_C=${CUR_TIME}-${COMMIT_ID::7}" >> $GITHUB_ENV; | |
env: | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
- name: Build binary | |
env: | |
GOOS: android | |
GOARCH: arm64 | |
CGO_ENABLED: 1 | |
CC: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android33-clang | |
CGO_FLAGS: -Werror=unused-variable -Werror=implicit-function-declaration -O2 | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
SEAL_TRUSTED_PRIVATE_KEY: ${{ secrets.SEAL_TRUSTED_PRIVATE_KEY }} | |
working-directory: ./sealdice-core | |
run: | | |
go build -o "output/sealdice-core" -trimpath -ldflags "-s -w -X sealdice-core/dice.VERSION_PRERELEASE=-dev -X sealdice-core/dice.VERSION_BUILD_METADATA=+${CUR_TIME}.${COMMIT_ID::7} -X sealdice-core/dice.APP_CHANNEL=dev -X 'sealdice-core/dice.DefaultSignUrl=${NT_SIGN_URL}' -X 'sealdice-core/dice.SealTrustedClientPrivateKey=${SEAL_TRUSTED_PRIVATE_KEY}'" . | |
- name: Upload Core | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sealdice-core_${{ env.PROJECT_VERSION_C }}_android_arm64 | |
path: ./sealdice-core/output | |
android-build: | |
name: Build Android Apk | |
runs-on: ubuntu-20.04 | |
needs: | |
- core-android-build | |
- resources-download | |
- lagrange-setup | |
env: | |
ANDROID_VERSION: ${{needs.commit-num-check.outputs.ANDROID_VERSION}} | |
steps: | |
- name: Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Get current time | |
uses: Kaven-Universe/github-action-current-date-time@v1 | |
id: currentTime | |
with: | |
format: YYYYMMDD | |
timezone-offset: -480 | |
- name: Set Env | |
run: | | |
echo "PROJECT_VERSION=dev-${CUR_TIME}.${COMMIT_ID::7}" >> $GITHUB_ENV; | |
echo "PROJECT_VERSION_C=${CUR_TIME}-${COMMIT_ID::7}" >> $GITHUB_ENV; | |
env: | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
- name: Get Core-android | |
uses: actions/download-artifact@v4 | |
with: | |
name: sealdice-core_${{ env.PROJECT_VERSION_C }}_android_arm64 | |
path: ./sealdice-android/app/src/main/assets/sealdice | |
- name: Get Documents | |
uses: actions/download-artifact@v4 | |
with: | |
name: documents | |
path: ./sealdice-android/app/src/main/assets/sealdice/data | |
- name: Get App-Runner | |
run: | | |
curl https://d1.sealdice.com/lagrange/app-runner-std-arm64.tar.gz > ./sealdice-android/app/src/main/assets/app-runner-arm64.tar.gz | |
- name: Get Lagrange | |
uses: actions/download-artifact@v4 | |
with: | |
name: lagrange.android-arm64 | |
path: ./sealdice-android/app/src/main/assets/sealdice/lagrange/ | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Set Execution Flag | |
working-directory: ./sealdice-android | |
run: chmod +x gradlew | |
- name: Remove ARCA Config | |
working-directory: ./sealdice-android/app/src/main/java/com/sealdice/dice | |
run: | | |
sed -i '/secrets.Auth.*/d' MyApplication.kt | |
sed -i '/httpSender {/,/}/d' MyApplication.kt | |
- name: Set Version | |
working-directory: ./sealdice-android/app | |
run: | | |
sed -i 's/versionName ".*"/versionName "${{ env.PROJECT_VERSION }}"/g' build.gradle | |
env: | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
- name: Build Apk | |
working-directory: ./sealdice-android | |
run: | | |
bash ./gradlew assembleDebug --stacktrace | |
- name: Sign Android release | |
uses: r0adkll/sign-android-release@v1 | |
# ID used to access action output | |
id: sign_app | |
with: | |
releaseDirectory: ./sealdice-android/app/build/outputs/apk/debug | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
env: | |
# override default build-tools version (29.0.3) -- optional | |
BUILD_TOOLS_VERSION: "34.0.0" | |
- name: Rename Apk | |
working-directory: ./sealdice-android | |
run: | | |
mv ./app/build/outputs/apk/debug/app-debug-signed.apk ./app/build/outputs/apk/debug/sealdice_${{ env.PROJECT_VERSION_C }}_arm64.apk | |
- name: Upload Apk | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sealdice_${{ env.PROJECT_VERSION_C }}_android_arm64 | |
path: ./sealdice-android/app/build/outputs/apk/debug/sealdice_${{ env.PROJECT_VERSION_C }}_arm64.apk | |
pc-pack: | |
name: PC Pack | |
runs-on: ubuntu-latest | |
needs: | |
- resources-download | |
# - gocqhttp-build | |
- core-build | |
- core-darwin-build | |
- lagrange-setup | |
strategy: | |
matrix: | |
# target: linux/amd64, linux/arm64, windows/amd64, darwin/amd64, darwin/arm64 | |
goos: [ linux, windows, darwin ] | |
goarch: [ '386', amd64, arm64 ] | |
exclude: | |
- goos: linux | |
goarch: '386' | |
- goos: windows | |
goarch: arm64 | |
- goos: windows | |
goarch: '386' | |
- goos: darwin | |
goarch: '386' | |
steps: | |
- name: Get current time | |
uses: Kaven-Universe/github-action-current-date-time@v1 | |
id: currentTime | |
with: | |
format: YYYYMMDD | |
timezone-offset: -480 | |
- name: Set Env | |
run: | | |
echo "PROJECT_VERSION_C=${CUR_TIME}-${COMMIT_ID::7}" >> $GITHUB_ENV; | |
env: | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
- name: Get Documents | |
uses: actions/download-artifact@v4 | |
with: | |
name: documents | |
path: ./data | |
- name: Get Lagrange | |
uses: actions/download-artifact@v4 | |
with: | |
name: lagrange.${{ matrix.goos }}-${{ matrix.goarch }} | |
path: ./lagrange/ | |
- name: Get Lagrange-Gocq | |
uses: actions/download-artifact@v4 | |
with: | |
name: lagrange-gocq.${{ matrix.goos }}-${{ matrix.goarch }} | |
path: ./lagrange/ | |
- name: Get Core | |
uses: actions/download-artifact@v4 | |
with: | |
name: sealdice-core_${{ env.PROJECT_VERSION_C }}_${{ matrix.goos }}_${{ matrix.goarch }} | |
path: . | |
- name: Set Execute Attribute | |
if: matrix.goos != 'windows' | |
run: chmod +x ./sealdice-core | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sealdice_${{ env.PROJECT_VERSION_C }}_${{ matrix.goos }}_${{ matrix.goarch }} | |
path: . | |
preparation: | |
name: Compressed Files Preparation | |
runs-on: ubuntu-20.04 | |
needs: | |
- pc-pack | |
- android-build | |
- commit-num-check | |
strategy: | |
matrix: | |
# target: linux/amd64, linux/arm64, windows/amd64, darwin/amd64, darwin/arm64, android/arm64 | |
goos: [ linux, windows, darwin ] | |
goarch: [ '386', amd64, arm64 ] | |
exclude: | |
- goos: linux | |
goarch: '386' | |
- goos: windows | |
goarch: arm64 | |
- goos: windows | |
goarch: '386' | |
- goos: darwin | |
goarch: '386' | |
include: | |
- goos: android | |
goarch: arm64 | |
env: | |
ANDROID_VERSION: ${{needs.commit-num-check.outputs.ANDROID_VERSION}} | |
steps: | |
- name: Get current time | |
uses: Kaven-Universe/github-action-current-date-time@v1 | |
id: currentTime | |
with: | |
format: YYYYMMDD | |
timezone-offset: -480 | |
- name: Set Env | |
run: | | |
echo "PROJECT_VERSION_C=${CUR_TIME}-${COMMIT_ID::7}" >> $GITHUB_ENV; | |
env: | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
- name: Get Files | |
uses: actions/download-artifact@v4 | |
with: | |
name: sealdice_${{ env.PROJECT_VERSION_C }}_${{ matrix.goos }}_${{ matrix.goarch }} | |
path: ./temp/ | |
- name: Compress (default) | |
if: matrix.goos != 'windows' && matrix.goos != 'android' | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
run: | | |
cd ./temp && find . -type f | cut -c 3- | tar -zcvf ../sealdice_${PROJECT_VERSION_C}_${GOOS}_${GOARCH}.tar.gz -T -; | |
echo "DIST=sealdice_${PROJECT_VERSION_C}_${GOOS}_${GOARCH}.tar.gz" >> $GITHUB_ENV; | |
- name: Compress (windows) | |
if: matrix.goos == 'windows' | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
run: | | |
cd ./temp | |
find . -type f | |
zip -r ../sealdice_${PROJECT_VERSION_C}_${GOOS}_${GOARCH}.zip . | |
echo "DIST=sealdice_${PROJECT_VERSION_C}_${GOOS}_${GOARCH}.zip" >> $GITHUB_ENV; | |
- name: Skip Compress (android) | |
if: matrix.goos == 'android' | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
run: | | |
mv ./temp/sealdice_${PROJECT_VERSION_C}_${GOARCH}.apk ./sealdice-android_${ANDROID_VERSION}_${PROJECT_VERSION_C}_${GOARCH}.APK | |
echo "DIST=sealdice-android_${ANDROID_VERSION}_${PROJECT_VERSION_C}_${GOARCH}.APK" >> $GITHUB_ENV; | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sealdice-prerelease_${{ env.PROJECT_VERSION_C }}_${{ matrix.goos }}_${{ matrix.goarch }} | |
path: ${{ env.DIST }} | |
prerelease: | |
name: Prerelease | |
runs-on: ubuntu-latest | |
needs: | |
- preparation | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get Files | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: sealdice-prerelease* | |
path: ./dist/ | |
merge-multiple: true | |
- name: Get current time | |
uses: Kaven-Universe/github-action-current-date-time@v1 | |
id: currentTime | |
with: | |
format: YYYYMMDD | |
timezone-offset: -480 | |
- name: Update Prerelease tag | |
run: | | |
git tag -f pre-release | |
git push -f origin pre-release | |
- name: Update Prerelease | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: pre-release | |
name: 'Latest Dev Build ${{ steps.currentTime.outputs.time }}' | |
prerelease: true | |
body: '> ⚠️注意️️:这是自动构建的预发布版本,非正式版本!' | |
artifacts: | | |
dist/sealdice* | |
allowUpdates: true | |
removeArtifacts: true | |
# 可以使用,但因为文件名都是 sealdice_dev-aea89ca_20230919_linux_arm64.tar.gz | |
# 这种形式 有一点捉急。就先屏蔽了 | |
# - uses: ryand56/r2-upload-action@latest | |
# continue-on-error: true | |
# with: | |
# r2-account-id: ${{ secrets.R2_ACCOUNT_ID }} | |
# r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} | |
# r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
# r2-bucket: ${{ secrets.R2_BUCKET }} | |
# source-dir: ./dist | |
# destination-dir: ./dev | |
docker-push: | |
name: Docker Push | |
runs-on: ubuntu-latest | |
needs: | |
- pc-pack | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Get current time | |
uses: Kaven-Universe/github-action-current-date-time@v1 | |
id: currentTime | |
with: | |
format: YYYYMMDD | |
timezone-offset: -480 | |
- name: Set Env | |
env: | |
CUR_TIME: ${{ steps.currentTime.outputs.time }} | |
run: | | |
echo "PROJECT_VERSION_C=${CUR_TIME}-${COMMIT_ID::7}" >> $GITHUB_ENV; | |
- name: Get Amd64 Files | |
uses: actions/download-artifact@v4 | |
with: | |
name: sealdice_${{ env.PROJECT_VERSION_C }}_linux_amd64 | |
path: ./amd64/ | |
- name: Get Arm64 Files | |
uses: actions/download-artifact@v4 | |
with: | |
name: sealdice_${{ env.PROJECT_VERSION_C }}_linux_arm64 | |
path: ./arm64/ | |
- name: Chmod | |
run: | |
chmod +x ./amd64/sealdice-core && chmod +x ./arm64/sealdice-core | |
- name: Docker Login | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository_owner }}/sealdice | |
tags: | | |
type=edge | |
type=sha,event=branch | |
type=ref,event=tag | |
- name: Docker Build | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./scripts/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
build-args: | | |
AUTHOR=${{ github.repository_owner }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
clear-temp-artifact: | |
name: Clear Temp Artifacts | |
if: always() | |
runs-on: ubuntu-latest | |
needs: | |
- prerelease | |
permissions: | |
actions: write | |
steps: | |
- uses: geekyeggo/delete-artifact@v4 | |
with: | |
token: ${{ github.token }} | |
name: | | |
documents | |
go-cqhttp* | |
sealdice-ui | |
sealdice-core* | |
sealdice-prerelease* |