From d428459f8c6defc4267d3c844a18734d5314dfff Mon Sep 17 00:00:00 2001 From: way-zer Date: Tue, 17 Sep 2024 18:28:31 +0800 Subject: [PATCH] fix ci --- .github/actions/clearOldAssets.ts | 19 ++++++++++++------- .github/workflows/build.yml | 11 +++++++---- jitpack.yml | 2 +- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/actions/clearOldAssets.ts b/.github/actions/clearOldAssets.ts index 224d9a7d2bfd..304652769624 100644 --- a/.github/actions/clearOldAssets.ts +++ b/.github/actions/clearOldAssets.ts @@ -1,12 +1,17 @@ import * as core from "@actions/core" -import {context, getOctokit} from "@actions/github" +import {getOctokit} from "@actions/github" -const octokit = getOctokit(import.meta.env.GITHUB_TOKEN) as import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api -const selfBuild = import.meta.env.RELEASE_VERSION +const octokit = getOctokit(import.meta.env.TOKEN!) as import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api -async function clearOldAssets(tag: string, keep: number = 9) { +const [owner, repo] = import.meta.env.REPOSITORY!.split("/") +const tag = core.getInput("release") || import.meta.env.TAG! +const selfBuild = import.meta.env.RELEASE_VERSION! +console.log(owner, repo, tag, selfBuild) + + +async function clearOldAssets(keep: number = 9) { const release = await octokit.rest.repos.getReleaseByTag({ - ...context.repo, tag + owner, repo, tag }) const assets = release.data.assets.sort((a, b) => a.name < b.name ? 1 : -1) if (assets.length <= keep) return @@ -15,9 +20,9 @@ async function clearOldAssets(tag: string, keep: number = 9) { console.log("ToRemove", toRemove.map(it => it.name)) await Promise.all(toRemove.map(it => octokit.rest.repos.deleteReleaseAsset({ - ...context.repo, asset_id: it.id + owner, repo, asset_id: it.id }) )) } -await clearOldAssets(core.getInput("release") || import.meta.env.TAG) \ No newline at end of file +await clearOldAssets() \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 56884e3d9811..50c4662d3094 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,15 +27,18 @@ jobs: build-scan-terms-of-use-agree: "yes" - name: Set env run: | + git config --global user.email "ci@noreply.example.com" + git config --global user.name "github_actions" echo "RELEASE_TAG=${GITHUB_REF_NAME}-build" >> $GITHUB_ENV echo "RELEASE_TAG=${GITHUB_REF_NAME}-build" echo "RELEASE_VERSION=$(date +'%Y.%m.%d').X${GITHUB_RUN_NUMBER}-${GITHUB_REF_NAME}" >> $GITHUB_ENV - echo "${{ secrets.KEYSTORE_BASE64 }}" | openssl enc -d -base64 -in - -out ../bekeystore.jks + echo "${{ secrets.KEYSTORE_BASE64 }}" | openssl enc -d -base64 -in - -out bekeystore.jks - name: Build run: | + git submodule update --init --depth=10 cd work - ../scripts/applyPatches + ../scripts/applyPatches.sh gradle desktop:dist server:dist -Pbuildversion=${RELEASE_VERSION} cd .. @@ -74,6 +77,6 @@ jobs: - name: clearOldAssets run: bun run .github/actions/clearOldAssets.ts env: - GITHUB_TOKEN: ${{secrets.PUBLISH_TOKEN}} - GITHUB_REPOSITORY: TinyLake/MindustryX-work + TOKEN: ${{secrets.PUBLISH_TOKEN}} + REPOSITORY: TinyLake/MindustryX-work TAG: ${{ env.RELEASE_TAG }} diff --git a/jitpack.yml b/jitpack.yml index d1830f955b41..82585fca29e2 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -7,6 +7,6 @@ install: # - cd work/ && git fetch origin v145.1 && git reset --hard FETCH_HEAD && cd .. - git config --global user.email "ci@noreply.example.com" - git config --global user.name "jitpack" - - sh ./scripts/applyPatches.sh && cd work/ + - cd work/ && sh ../scripts/applyPatches.sh - ./gradlew publishToMavenLocal - echo -n > gradle.properties #zero out gradle.properties \ No newline at end of file