bug fixed.

This commit is contained in:
AirryCo
2025-03-17 18:20:11 +08:00
parent 27007cc5ff
commit a46763733d
4 changed files with 46 additions and 101 deletions

View File

@@ -34,8 +34,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Latest Tag From SPT
id: get-latest-tag
run: |
@@ -107,7 +105,6 @@ jobs:
runs-on: ubuntu-latest
env:
OUTPUT_DIR: spt-server
SOURCECODE_DIR: ${{ github.workspace }}/code
DOCKERHUB_USER: stblog
DOCKERHUB_REPOSITORY: spt-server
@@ -123,36 +120,36 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: '${{ env.REPOSITORY_SPT_SERVER_AIRRYCO }}'
ref: '${{ env.RELEASE_BRANCH }}'
lfs: 'false'
fetch-depth: '0'
token: '${{ secrets.AIRRYCO_TOKEN }}'
- name: Setup Git Config
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "bot@github.com"
- name: Clone AirryCo's Linux Server Code
run: |
git clone -b ${{ env.RELEASE_BRANCH }} ${{ env.SERVER_URL }}/${{ env.REPOSITORY_SPT_SERVER_AIRRYCO }} ${{ env.SOURCECODE_DIR }}
cd ${{ env.SOURCECODE_DIR }}
git lfs pull
shell: bash
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.11.1
node-version: 22.12.0
- name: Merge Server Code From SPT
run: |
cd ${{ env.SOURCECODE_DIR }}
git config -f .lfsconfig lfs.url https://${{ secrets.GITEA_PUSH_TOKEN }}:@git.rui.he.cn:3000/henry/spt-server.git/info/lfs
git lfs pull
git pull
git fetch -u ${{ env.SERVER_URL }}/${{ env.REPOSITORY_SPT_SERVER }}.git ${{ env.RELEASE_BRANCH }}:SPT-${{ env.RELEASE_BRANCH }}
git merge -m "🤖 Merge tag \`${{ needs.prepare.outputs.TARGET_TAG }}\` from SPT" --no-ff ${{ needs.prepare.outputs.TARGET_TAG }}
git tag -d ${{ needs.prepare.outputs.TARGET_TAG }}
git tag ${{ needs.prepare.outputs.TARGET_TAG }}
shell: bash
- name: Runner Debug Information
id: debug-info
run: |
cp -v ${{ env.SOURCECODE_DIR }}/project/package.json .
cd ${{ env.SOURCECODE_DIR }}
echo "git version: $(git --version)"
echo "git lfs version: $(git-lfs --version)"
echo "node.js version: $(node --version)"
@@ -168,7 +165,7 @@ jobs:
uses: actions/cache@v4
with:
path: |
${{ env.SOURCECODE_DIR }}/project/node_modules
project/node_modules
key: ${{ runner.os }}-npm-dependencies-${{ hashFiles('package.json') }}
restore-keys: |
${{ runner.os }}-npm-dependencies-
@@ -176,14 +173,15 @@ jobs:
- name: Install NPM Dependencies
if: steps.cache-npm-dependencies.outputs.cache-hit != 'true'
run: |
cd ${{ env.SOURCECODE_DIR }}/project
cd project
npm install
shell: bash
- name: Build Linux Server
id: build-server
run: |
cd ${{ env.SOURCECODE_DIR }}/project
git checkout ${{ needs.prepare.outputs.TARGET_TAG }}
cd project
npm run build:release
ls -l build
mv build ${{ env.OUTPUT_DIR }}
@@ -203,18 +201,17 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ steps.filename.outputs.LINUX_ARTIFACT }}
path: ${{ env.SOURCECODE_DIR }}/project/${{ env.OUTPUT_DIR }}
path: project/${{ env.OUTPUT_DIR }}
overwrite: true
retention-days: 1
- name: Push Linux Server Code And Tag
- name: Push Linux Server Code
run: |
cd ${{ env.SOURCECODE_DIR }}
git pull
REMOTE_URL="https://AirryCo:${{ secrets.AIRRYCO_TOKEN }}@github.com/${{ env.REPOSITORY_SPT_SERVER_AIRRYCO }}.git"
git remote set-url origin "$REMOTE_URL"
git push
git tag -d ${{ needs.prepare.outputs.TARGET_TAG }}
git tag ${{ needs.prepare.outputs.TARGET_TAG }}
git config -f .lfsconfig lfs.url https://${{ secrets.GITEA_PUSH_TOKEN }}:@git.rui.he.cn:3000/henry/spt-server.git/info/lfs
git push -u origin ${{ env.RELEASE_BRANCH }}
git push -u origin ${{ needs.prepare.outputs.TARGET_TAG }}
shell: bash
@@ -228,6 +225,10 @@ jobs:
GHCR_USER: airryco
GHCR_REPOSITORY: spt-server
outputs:
DOCKER_DIGEST: ${{ steps.build-and-push.outputs.digest }}
DOCKER_IMAGEID: ${{ steps.build-and-push.outputs.imageid }}
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -237,7 +238,7 @@ jobs:
# docker
- name: Extract metadata for Docker with release version
if: ${{ !contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
if: ${{ !contains(needs.prepare.outputs.TARGET_TAG, 'BE') }}
id: meta
uses: docker/metadata-action@v5
with:
@@ -250,7 +251,7 @@ jobs:
type=semver,pattern={{major}}.{{minor}},value=${{ needs.prepare.outputs.TARGET_TAG }}
type=raw,value=latest
- name: Extract metadata for Docker with release version and fika built-in
if: ${{ !contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
if: ${{ !contains(needs.prepare.outputs.TARGET_TAG, 'BE') }}
id: meta-fika
uses: docker/metadata-action@v5
with:
@@ -262,30 +263,6 @@ jobs:
type=semver,pattern={{version}}-fika,value=${{ needs.prepare.outputs.TARGET_TAG }}
type=semver,pattern={{major}}.{{minor}}-fika,value=${{ needs.prepare.outputs.TARGET_TAG }}
type=raw,value=latest-fika
- name: Extract metadata for Docker with bem version
if: ${{ contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
id: meta-bem
uses: docker/metadata-action@v5
with:
images: |
${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPOSITORY }}
ghcr.io/${{ env.GHCR_USER }}/${{ env.GHCR_REPOSITORY }}
registry.cn-shenzhen.aliyuncs.com/spt-server/spt-server
tags: |
type=semver,pattern={{version}},value=${{ needs.prepare.outputs.TARGET_TAG }}
type=semver,pattern={{major}}.{{minor}},value=${{ needs.prepare.outputs.TARGET_TAG }}
- name: Extract metadata for Docker with bem version and fika built-in
if: ${{ contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
id: meta-bem-fika
uses: docker/metadata-action@v5
with:
images: |
${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPOSITORY }}
ghcr.io/${{ env.GHCR_USER }}/${{ env.GHCR_REPOSITORY }}
registry.cn-shenzhen.aliyuncs.com/spt-server/spt-server
tags: |
type=semver,pattern={{version}}-fika,value=${{ needs.prepare.outputs.TARGET_TAG }}
type=semver,pattern={{major}}.{{minor}}-fika,value=${{ needs.prepare.outputs.TARGET_TAG }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@@ -314,7 +291,7 @@ jobs:
password: ${{ secrets.ALIYUN_REGISTRY_TOKEN }}
- name: Build and Push For Release With Fika
if: ${{ !contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
if: ${{ !contains(needs.prepare.outputs.TARGET_TAG, 'BE') }}
uses: docker/build-push-action@v6
with:
context: ./docker
@@ -328,7 +305,7 @@ jobs:
org.opencontainers.image.revision=${{ needs.build-server-linux.outputs.LINUX_COMMIT_ID_WHOLE }}
platforms: linux/amd64,linux/arm64
- name: Build and Push For Release
if: ${{ !contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
if: ${{ !contains(needs.prepare.outputs.TARGET_TAG, 'BE') }}
uses: docker/build-push-action@v6
with:
context: ./docker
@@ -341,40 +318,11 @@ jobs:
org.opencontainers.image.revision=${{ needs.build-server-linux.outputs.LINUX_COMMIT_ID_WHOLE }}
platforms: linux/amd64,linux/arm64
- name: Build and Push For BEM With Fika
if: ${{ contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
uses: docker/build-push-action@v6
with:
context: ./docker
file: ./docker/Dockerfile-fika
push: true
tags: ${{ steps.meta-bem-fika.outputs.tags }}
labels: |
${{ steps.meta-bem-fika.outputs.labels }}
org.opencontainers.image.source=https://github.com/AirryCo/spt-server
org.opencontainers.image.url=https://github.com/AirryCo/spt-server
org.opencontainers.image.revision=${{ needs.build-server-linux.outputs.LINUX_COMMIT_ID_WHOLE }}
platforms: linux/amd64,linux/arm64
- name: Build and Push For BEM
if: ${{ contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
uses: docker/build-push-action@v6
with:
context: ./docker
push: true
tags: ${{ steps.meta-bem.outputs.tags }}
labels: |
${{ steps.meta-bem.outputs.labels }}
org.opencontainers.image.source=https://github.com/AirryCo/spt-server
org.opencontainers.image.url=https://github.com/AirryCo/spt-server
org.opencontainers.image.revision=${{ needs.build-server-linux.outputs.LINUX_COMMIT_ID_WHOLE }}
platforms: linux/amd64,linux/arm64
build-server-windows:
needs: [prepare, build-server-linux]
runs-on: windows-latest
env:
OUTPUT_DIR: spt-server
SOURCECODE_DIR: c:/snapshot
outputs:
WIN_COMMIT_ID: ${{ steps.debug-info.outputs.COMMIT_ID }}
WIN_ARTIFACT: ${{ steps.filename.outputs.WIN_ARTIFACT }}
@@ -384,38 +332,35 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Clone AirroCo's Server Code
run: |
git clone -b ${{ env.RELEASE_BRANCH }} --depth=1 ${{ env.SERVER_URL }}/${{ env.REPOSITORY_SPT_SERVER_AIRRYCO }} ${{ env.SOURCECODE_DIR }}
cd ${{ env.SOURCECODE_DIR }}
git lfs pull
shell: bash
with:
repository: '${{ env.REPOSITORY_SPT_SERVER_AIRRYCO }}'
ref: '${{ env.RELEASE_BRANCH }}'
lfs: 'false'
fetch-depth: '1'
token: '${{ secrets.AIRRYCO_TOKEN }}'
# Modify the JSON file with PowerShell
- name: Modify JSON file with PowerShell
run: |
cd ${{ env.SOURCECODE_DIR }}/project/assets/configs
cd project/assets/configs
$json = Get-Content -Path "core.json" | ConvertFrom-Json
$json.projectName = "AirryCo's SPT Windows"
$json | ConvertTo-Json -Depth 10 | Set-Content -Path "core.json"
shell: pwsh
- name: Replace serverExeName
run: |
cd ${{ env.SOURCECODE_DIR }}/project
cd project
sed -i 's/SPT.Server/SPT.Server.exe/g' gulpfile.mjs
shell: bash
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.11.1
node-version: 22.12.0
- name: Runner Debug Information
id: debug-info
run: |
cp -v ${{ env.SOURCECODE_DIR }}/project/package.json .
cd ${{ env.SOURCECODE_DIR }}
echo "git version: $(git --version)"
echo "git lfs version: $(git-lfs --version)"
echo "node.js version: $(node --version)"
@@ -430,7 +375,7 @@ jobs:
uses: actions/cache@v4
with:
path: |
${{ env.SOURCECODE_DIR }}/project/node_modules
project/node_modules
key: ${{ runner.os }}-npm-dependencies-${{ hashFiles('package.json') }}
restore-keys: |
${{ runner.os }}-npm-dependencies-
@@ -438,14 +383,14 @@ jobs:
- name: Install NPM Dependencies
if: steps.cache-npm-dependencies.outputs.cache-hit != 'true'
run: |
cd ${{ env.SOURCECODE_DIR }}/project
cd project
npm install
shell: pwsh
- name: Build Windows Server
id: build-server
run: |
cd ${{ env.SOURCECODE_DIR }}/project
cd project
npm run build:release
ls -l build
mv build ${{ env.OUTPUT_DIR }}
@@ -465,7 +410,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ steps.filename.outputs.WIN_ARTIFACT }}
path: ${{ env.SOURCECODE_DIR }}/project/${{ env.OUTPUT_DIR }}
path: project/${{ env.OUTPUT_DIR }}
overwrite: true
assemble-and-publish:
@@ -582,7 +527,7 @@ jobs:
- name: Create Github Release
id: create_release
if: ${{ !contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
if: ${{ !contains(needs.prepare.outputs.TARGET_TAG, 'BE') }}
uses: softprops/action-gh-release@v2
with:
name: ${{ needs.prepare.outputs.TARGET_TAG }}