From 32cdb0c07a7e71140e858d8837d4f3a77c0058f2 Mon Sep 17 00:00:00 2001 From: AirryCo Date: Wed, 19 Mar 2025 13:20:20 +0800 Subject: [PATCH] 3.11.1 --- .github/workflows/build-release-cron.yaml | 2 +- .github/workflows/build-release-manual.yaml | 124 ++++++-------------- docker/Dockerfile-manual | 2 +- docker/Dockerfile-manual-fika | 4 +- 4 files changed, 42 insertions(+), 90 deletions(-) diff --git a/.github/workflows/build-release-cron.yaml b/.github/workflows/build-release-cron.yaml index 7e62db3..408301c 100644 --- a/.github/workflows/build-release-cron.yaml +++ b/.github/workflows/build-release-cron.yaml @@ -479,7 +479,7 @@ jobs: - name: Create Github Pre-release id: create_pre_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 }} diff --git a/.github/workflows/build-release-manual.yaml b/.github/workflows/build-release-manual.yaml index 2c6c1f5..f9ffc26 100644 --- a/.github/workflows/build-release-manual.yaml +++ b/.github/workflows/build-release-manual.yaml @@ -94,7 +94,6 @@ jobs: runs-on: ubuntu-latest env: OUTPUT_DIR: spt-server - SOURCECODE_DIR: ${{ github.workspace }}/code DOCKERHUB_USER: stblog DOCKERHUB_REPOSITORY: spt-server @@ -110,15 +109,17 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + repository: '${{ env.REPOSITORY_SPT_SERVER_AIRRYCO }}' + ref: '${{ github.ref_name }}' + 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 ${{ github.ref_name }} ${{ env.SERVER_URL }}/${{ env.REPOSITORY_SPT_SERVER_AIRRYCO }} ${{ env.SOURCECODE_DIR }} - 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 shell: bash @@ -130,8 +131,6 @@ jobs: - 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)" @@ -147,22 +146,22 @@ jobs: uses: actions/cache@v4 with: path: | - ${{ env.SOURCECODE_DIR }}/project/node_modules - key: ${{ runner.os }}-npm-dependencies-${{ hashFiles('package.json') }} + project/node_modules + key: ${{ runner.os }}-npm-dependencies-${{ hashFiles('project/package.json') }} restore-keys: | ${{ runner.os }}-npm-dependencies- - 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 + cd project npm run build:release ls -l build mv build ${{ env.OUTPUT_DIR }} @@ -182,8 +181,9 @@ 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 build-docker-image-multi-arch: needs: [prepare, build-server-linux] @@ -194,9 +194,16 @@ 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 + - name: Git pull + run: | + git pull # docker - name: Extract metadata for Docker with release version @@ -225,30 +232,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, 'BE') }} - 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, 'BE') }} - 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 @@ -305,41 +288,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, 'BE') }} - uses: docker/build-push-action@v6 - with: - context: ./docker - file: ./docker/Dockerfile-manual-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, 'BE') }} - uses: docker/build-push-action@v6 - with: - context: ./docker - file: ./docker/Dockerfile-manual - 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 }} @@ -349,38 +302,35 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - - name: Clone AirroCo's Server Code - run: | - git clone -b ${{ github.ref_name }} --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: '${{ github.ref_name }}' + 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)" @@ -395,22 +345,24 @@ jobs: uses: actions/cache@v4 with: path: | - ${{ env.SOURCECODE_DIR }}/project/node_modules - key: ${{ runner.os }}-npm-dependencies-${{ hashFiles('package.json') }} + project/node_modules + key: ${{ runner.os }}-npm-dependencies-${{ hashFiles('project/package.json') }} restore-keys: | ${{ runner.os }}-npm-dependencies- - 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 + 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 + cd project npm run build:release ls -l build mv build ${{ env.OUTPUT_DIR }} @@ -430,7 +382,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: @@ -479,7 +431,7 @@ jobs: - name: Create Github Pre-release id: create_pre_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 }} @@ -528,7 +480,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 }} diff --git a/docker/Dockerfile-manual b/docker/Dockerfile-manual index 5b9dca1..218cb95 100644 --- a/docker/Dockerfile-manual +++ b/docker/Dockerfile-manual @@ -1,6 +1,6 @@ FROM node:20.11.1-bullseye AS server-builder RUN apt update && apt install -y git git-lfs p7zip-full && \ - git clone -b 3.10.5 --depth=1 https://github.com/AirryCo/spt-server.git /snapshot && \ + git clone -b 3.11.1 --depth=1 https://github.com/AirryCo/spt-server.git /snapshot && \ cd /snapshot && git lfs pull && \ cd project && \ npm install && npm run build:release && \ diff --git a/docker/Dockerfile-manual-fika b/docker/Dockerfile-manual-fika index c8aab78..4a0a927 100644 --- a/docker/Dockerfile-manual-fika +++ b/docker/Dockerfile-manual-fika @@ -1,13 +1,13 @@ FROM node:20.11.1-alpine AS fika-builder RUN apk add --no-cache git unzip && \ - git clone -b v2.3.6 --depth=1 https://github.com/project-fika/Fika-Server.git /fika-server && \ + git clone -b v2.4.1 --depth=1 https://github.com/project-fika/Fika-Server.git /fika-server && \ cd /fika-server && \ npm install && npm run build && \ mkdir output && cd output && unzip /fika-server/dist/*.zip FROM node:20.11.1-bullseye AS server-builder RUN apt update && apt install -y git git-lfs p7zip-full && \ - git clone -b 3.10.5 --depth=1 https://github.com/AirryCo/spt-server.git /snapshot && \ + git clone -b 3.11.1 --depth=1 https://github.com/AirryCo/spt-server.git /snapshot && \ cd /snapshot && git lfs pull && \ cd project && \ npm install && npm run build:release && \