From 1fb2e5fc104145d8d7d74d3923225b4d00dc143f Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 18:28:12 +0800 Subject: [PATCH 01/16] Create webpack.yml --- .github/workflows/webpack.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/webpack.yml diff --git a/.github/workflows/webpack.yml b/.github/workflows/webpack.yml new file mode 100644 index 000000000..d72abc20d --- /dev/null +++ b/.github/workflows/webpack.yml @@ -0,0 +1,28 @@ +name: NodeJS with Webpack名称: NodeJS与Webpack + +on:触发: + push:推送: + branches: [ "master" ]分支: [ "master" ]分支: [ "master" ]分支: [ "master" ] + pull_request:拉取请求拉取请求: + branches: [ "master" ]分支: [ "master" ]分支: [ "master" ]分支: [ "master" ]分支: [ "master" ]分支: [ "master" ]分支: [ "master" ]分支: [ "master" ] + +jobs:作业: + build:构建: + runs-on: ubuntu-latest运行于: ubuntu-latest + + strategy:策略: + matrix:矩阵: + node-version: [18.x, 20.x, 22.x]节点版本: [18.x,20.x,22.x] + + steps:步骤:步骤:步骤:步骤:步骤:步骤:步骤步骤:步骤:步骤:步骤:步骤:步骤:步骤:步骤: + - uses使用: actions/checkout@v4 - 使用: actions/checkout@v4 - 使用: actions/checkout@v4 - 使用: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} - name: 使用 Node.js ${{matrix.node-version}} - name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}} - name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}} - name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}} - name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}}- name: 使用 Node.js ${{matrix.node-version}} + uses: actions/setup-node@v4用途: actions/setup-node@v4 + with:与:与:与:与:与:与:与: + node-version: ${{ matrix.node-version }} + + - name: Build - 名称: 构建 - name: 构建 - 名称: 构建 - name: 构建 - 名称: 构建 - 名称: 构建 - name: 构建 - 名称: - name: 构建 - 名称: 构建 - name: 构建 - 名称: 构建 - 名称: 构建 - name: 构建 - 名称: 构建 - 名称: 构建 - 名称: 构建 - 名称: 构建 - name: 构建 - 名称: 构建 - 名称: 构建 - 名称: 构建 - 名称: 构建 - 名称: 构建 + run: |运行: |运行: |运行: |运行: |运行: |运行: |运行: |运行: |运行: |运行: |运行: |运行: | + npm installnpm 安装npm 安装npm 安装 + npx webpack From ce61e50b4287b0bf2065b0b6d9105a63eda2039a Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 18:37:34 +0800 Subject: [PATCH 02/16] build-apk.yml --- .github/workflows/main.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..6565aeaa0 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,27 @@ +name: Build Android APK + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: npm install + + - name: Build Android APK + run: npm run build-android + + - name: Upload APK + uses: actions/upload-artifact@v4 + with: + name: XlingMusic-APK + path: release/*.apk From bed34770d6045c6c267bfd86d6455fd0f958fd52 Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 18:42:49 +0800 Subject: [PATCH 03/16] Update main.yml --- .github/workflows/main.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6565aeaa0..78a9c8644 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,8 @@ -name: Build Android APK +name: Build APK on: + push: + branches: master workflow_dispatch: jobs: @@ -9,19 +11,19 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Node - uses: actions/setup-node@v4 + - name: Setup Node.js 18 + uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 18 - name: Install dependencies - run: npm install + run: yarn install --frozen-lockfile - name: Build Android APK - run: npm run build-android + run: yarn build:android - name: Upload APK - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: XlingMusic-APK - path: release/*.apk + path: ./release/ From 3ee8ef904f174c2652d8d7c3911b7bcb97f949ea Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 18:43:35 +0800 Subject: [PATCH 04/16] Update main.yml From 68e62e043555d1575d86bb454574d763a79b1412 Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 18:52:37 +0800 Subject: [PATCH 05/16] Update main.yml --- .github/workflows/main.yml | 127 ++++++++++++++++++++++++++++++++----- 1 file changed, 112 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 78a9c8644..3acc1d355 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,29 +1,126 @@ -name: Build APK - +name: Build Android APK on: - push: - branches: master workflow_dispatch: - jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 - - name: Setup Node.js 18 - uses: actions/setup-node@v3 + - name: Setup Flutter + uses: subosito/flutter-action@v2 with: - node-version: 18 + flutter-version: 3.13.0 + channel: stable + + - name: Flutter doctor + run: flutter doctor - name: Install dependencies - run: yarn install --frozen-lockfile + run: flutter pub get - - name: Build Android APK - run: yarn build:android + - name: Build Release APK + run: flutter build apk --release --split-per-abi - name: Upload APK - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: XlingMusic-APK - path: ./release/ + name: MusicFree-Release-APK + path: build/app/outputs/flutter-apk/ + - name: Setup Java JDK + uses: actions/setup-java@v5.2.0 + with: + # The Java version to set up. Takes a whole or semver Java version. See examples of supported syntax in README file + java-version: # optional + # The path to the `.java-version` file. See examples of supported syntax in README file + java-version-file: # optional + # Java distribution. See the list of supported distributions in README file + distribution: + # The package type (jdk, jre, jdk+fx, jre+fx) + java-package: # optional, default is jdk + # The architecture of the package (defaults to the action runner's architecture) + architecture: # optional + # Path to where the compressed JDK is located + jdkFile: # optional + # Set this option if you want the action to check for the latest available version that satisfies the version spec + check-latest: # optional + # ID of the distributionManagement repository in the pom.xml file. Default is `github` + server-id: # optional, default is github + # Environment variable name for the username for authentication to the Apache Maven repository. Default is $GITHUB_ACTOR + server-username: # optional, default is GITHUB_ACTOR + # Environment variable name for password or token for authentication to the Apache Maven repository. Default is $GITHUB_TOKEN + server-password: # optional, default is GITHUB_TOKEN + # Path to where the settings.xml file will be written. Default is ~/.m2. + settings-path: # optional + # Overwrite the settings.xml file if it exists. Default is "true". + overwrite-settings: # optional, default is true + # GPG private key to import. Default is empty string. + gpg-private-key: # optional + # Environment variable name for the GPG private key passphrase. Default is $GPG_PASSPHRASE. + gpg-passphrase: # optional + # Name of the build platform to cache dependencies. It can be "maven", "gradle" or "sbt". + cache: # optional + # The path to a dependency file: pom.xml, build.gradle, build.sbt, etc. This option can be used with the `cache` option. If this option is omitted, the action searches for the dependency file in the entire repository. This option supports wildcards and a list of file names for caching multiple dependencies. + cache-dependency-path: # optional + # Workaround to pass job status to post job step. This variable is not intended for manual setting + job-status: # optional, default is ${{ job.status }} + # The token used to authenticate when fetching version manifests hosted on github.com, such as for the Microsoft Build of OpenJDK. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. + token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }} + # Name of Maven Toolchain ID if the default name of "${distribution}_${java-version}" is not wanted. See examples of supported syntax in Advanced Usage file + mvn-toolchain-id: # optional + # Name of Maven Toolchain Vendor if the default name of "${distribution}" is not wanted. See examples of supported syntax in Advanced Usage file + mvn-toolchain-vendor: # optional + - name: Setup Java JDK + uses: actions/setup-java@v5.2.0 + with: + # The Java version to set up. Takes a whole or semver Java version. See examples of supported syntax in README file + java-version: # optional + # The path to the `.java-version` file. See examples of supported syntax in README file + java-version-file: # optional + # Java distribution. See the list of supported distributions in README file + distribution: + # The package type (jdk, jre, jdk+fx, jre+fx) + java-package: # optional, default is jdk + # The architecture of the package (defaults to the action runner's architecture) + architecture: # optional + # Path to where the compressed JDK is located + jdkFile: # optional + # Set this option if you want the action to check for the latest available version that satisfies the version spec + check-latest: # optional + # ID of the distributionManagement repository in the pom.xml file. Default is `github` + server-id: # optional, default is github + # Environment variable name for the username for authentication to the Apache Maven repository. Default is $GITHUB_ACTOR + server-username: # optional, default is GITHUB_ACTOR + # Environment variable name for password or token for authentication to the Apache Maven repository. Default is $GITHUB_TOKEN + server-password: # optional, default is GITHUB_TOKEN + # Path to where the settings.xml file will be written. Default is ~/.m2. + settings-path: # optional + # Overwrite the settings.xml file if it exists. Default is "true". + overwrite-settings: # optional, default is true + # GPG private key to import. Default is empty string. + gpg-private-key: # optional + # Environment variable name for the GPG private key passphrase. Default is $GPG_PASSPHRASE. + gpg-passphrase: # optional + # Name of the build platform to cache dependencies. It can be "maven", "gradle" or "sbt". + cache: # optional + # The path to a dependency file: pom.xml, build.gradle, build.sbt, etc. This option can be used with the `cache` option. If this option is omitted, the action searches for the dependency file in the entire repository. This option supports wildcards and a list of file names for caching multiple dependencies. + cache-dependency-path: # optional + # Workaround to pass job status to post job step. This variable is not intended for manual setting + job-status: # optional, default is ${{ job.status }} + # The token used to authenticate when fetching version manifests hosted on github.com, such as for the Microsoft Build of OpenJDK. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. + token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }} + # Name of Maven Toolchain ID if the default name of "${distribution}_${java-version}" is not wanted. See examples of supported syntax in Advanced Usage file + mvn-toolchain-id: # optional + # Name of Maven Toolchain Vendor if the default name of "${distribution}" is not wanted. See examples of supported syntax in Advanced Usage file + mvn-toolchain-vendor: # optional + From 14184b674f8cdf1c80c2f64f75064680377bb323 Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 18:56:38 +0800 Subject: [PATCH 06/16] Add GitHub Actions workflow for GKE deployment This workflow builds a Docker container, publishes it to Google Container Registry, and deploys it to GKE upon a push to the master branch. It includes steps for authentication, Docker image building, and deployment using Kustomize. --- .github/workflows/google.yml | 116 +++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 .github/workflows/google.yml diff --git a/.github/workflows/google.yml b/.github/workflows/google.yml new file mode 100644 index 000000000..dcbf112a4 --- /dev/null +++ b/.github/workflows/google.yml @@ -0,0 +1,116 @@ +# This workflow will build a docker container, publish it to Google Container +# Registry, and deploy it to GKE when there is a push to the "master" +# branch. +# +# To configure this workflow: +# +# 1. Enable the following Google Cloud APIs: +# +# - Artifact Registry (artifactregistry.googleapis.com) +# - Google Kubernetes Engine (container.googleapis.com) +# - IAM Credentials API (iamcredentials.googleapis.com) +# +# You can learn more about enabling APIs at +# https://support.google.com/googleapi/answer/6158841. +# +# 2. Ensure that your repository contains the necessary configuration for your +# Google Kubernetes Engine cluster, including deployment.yml, +# kustomization.yml, service.yml, etc. +# +# 3. Create and configure a Workload Identity Provider for GitHub: +# https://github.com/google-github-actions/auth#preferred-direct-workload-identity-federation. +# +# Depending on how you authenticate, you will need to grant an IAM principal +# permissions on Google Cloud: +# +# - Artifact Registry Administrator (roles/artifactregistry.admin) +# - Kubernetes Engine Developer (roles/container.developer) +# +# You can learn more about setting IAM permissions at +# https://cloud.google.com/iam/docs/manage-access-other-resources +# +# 5. Change the values in the "env" block to match your values. + +name: 'Build and Deploy to GKE' + +on: + push: + branches: + - '"master"' + +env: + PROJECT_ID: 'my-project' # TODO: update to your Google Cloud project ID + GAR_LOCATION: 'us-central1' # TODO: update to your region + GKE_CLUSTER: 'cluster-1' # TODO: update to your cluster name + GKE_ZONE: 'us-central1-c' # TODO: update to your cluster zone + DEPLOYMENT_NAME: 'gke-test' # TODO: update to your deployment name + REPOSITORY: 'samples' # TODO: update to your Artifact Registry docker repository name + IMAGE: 'static-site' + WORKLOAD_IDENTITY_PROVIDER: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider' # TODO: update to your workload identity provider + +jobs: + setup-build-publish-deploy: + name: 'Setup, Build, Publish, and Deploy' + runs-on: 'ubuntu-latest' + environment: 'production' + + permissions: + contents: 'read' + id-token: 'write' + + steps: + - name: 'Checkout' + uses: 'actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332' # actions/checkout@v4 + + # Configure Workload Identity Federation and generate an access token. + # + # See https://github.com/google-github-actions/auth for more options, + # including authenticating via a JSON credentials file. + - id: 'auth' + name: 'Authenticate to Google Cloud' + uses: 'google-github-actions/auth@f112390a2df9932162083945e46d439060d66ec2' # google-github-actions/auth@v2 + with: + workload_identity_provider: '${{ env.WORKLOAD_IDENTITY_PROVIDER }}' + + # Authenticate Docker to Google Cloud Artifact Registry + - name: 'Docker Auth' + uses: 'docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567' # docker/login-action@v3 + with: + username: 'oauth2accesstoken' + password: '${{ steps.auth.outputs.auth_token }}' + registry: '${{ env.GAR_LOCATION }}-docker.pkg.dev' + + # Get the GKE credentials so we can deploy to the cluster + - name: 'Set up GKE credentials' + uses: 'google-github-actions/get-gke-credentials@6051de21ad50fbb1767bc93c11357a49082ad116' # google-github-actions/get-gke-credentials@v2 + with: + cluster_name: '${{ env.GKE_CLUSTER }}' + location: '${{ env.GKE_ZONE }}' + + # Build the Docker image + - name: 'Build and push Docker container' + run: |- + DOCKER_TAG="${GAR_LOCATION}-docker.pkg.dev/${PROJECT_ID}/${REPOSITORY}/${IMAGE}:${GITHUB_SHA}" + + docker build \ + --tag "${DOCKER_TAG}" \ + --build-arg GITHUB_SHA="${GITHUB_SHA}" \ + --build-arg GITHUB_REF="${GITHUB_REF}" \ + . + + docker push "${DOCKER_TAG}" + + # Set up kustomize + - name: 'Set up Kustomize' + run: |- + curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.4.3/kustomize_v5.4.3_linux_amd64.tar.gz + chmod u+x ./kustomize + + # Deploy the Docker image to the GKE cluster + - name: 'Deploy to GKE' + run: |- + # replacing the image name in the k8s template + ./kustomize edit set image LOCATION-docker.pkg.dev/PROJECT_ID/REPOSITORY/IMAGE:TAG=$GAR_LOCATION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA + ./kustomize build . | kubectl apply -f - + kubectl rollout status deployment/$DEPLOYMENT_NAME + kubectl get services -o wide From 5de8a957bf24636b97cfd18316d8dac5e8e60bfb Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 19:05:59 +0800 Subject: [PATCH 07/16] Update build-beta.yml --- .github/workflows/build-beta.yml | 117 +++++-------------------------- 1 file changed, 17 insertions(+), 100 deletions(-) diff --git a/.github/workflows/build-beta.yml b/.github/workflows/build-beta.yml index 3db406106..7d0faa2b8 100644 --- a/.github/workflows/build-beta.yml +++ b/.github/workflows/build-beta.yml @@ -1,119 +1,36 @@ -name: Beta 构建 - +name: 自动构建APK on: - push: - branches: [dev] - paths: ['package.json'] workflow_dispatch: - inputs: - force_build: - description: '强制构建 Beta 版本' - required: false - default: 'false' - type: boolean jobs: - check-version: - if: github.actor == 'maotoumao' || github.event_name == 'push' - runs-on: ubuntu-latest - outputs: - should_build: ${{ steps.version_check.outputs.should_build }} - version: ${{ steps.version_check.outputs.version }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Check version format - id: version_check - run: | - VERSION=$(node -p "require('./package.json').version") - echo "Current version: $VERSION" - - # 检查版本是否符合 -beta.xx 格式 - if [[ $VERSION =~ -beta\.[0-9]{1,2}$ ]]; then - echo "✅ Version matches beta format: $VERSION" - echo "should_build=true" >> $GITHUB_OUTPUT - echo "version=$VERSION" >> $GITHUB_OUTPUT - elif [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.force_build }}" == "true" ]]; then - echo "🔧 Force build triggered by workflow_dispatch" - echo "should_build=true" >> $GITHUB_OUTPUT - echo "version=$VERSION" >> $GITHUB_OUTPUT - else - echo "❌ Version does not match beta format or not forced: $VERSION" - echo "should_build=false" >> $GITHUB_OUTPUT - fi - - build-beta: - needs: check-version - if: needs.check-version.outputs.should_build == 'true' + build: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Setup Java + - name: 安装 Java JDK uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' - cache: 'gradle' - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - - name: Cache React Native dependencies - uses: actions/cache@v4 + - name: 安装 Flutter 环境 + uses: subosito/flutter-action@v2 with: - path: | - node_modules - ~/.gradle/caches - ~/.gradle/wrapper - android/.gradle - key: ${{ runner.os }}-rn-${{ hashFiles('package-lock.json', 'android/gradle/wrapper/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-rn- + flutter-version: '3.16.0' + channel: stable - - name: Install Dependencies - run: npm ci --prefer-offline --no-audit - - - name: Setup Keystore (if secrets available) - if: ${{ secrets.RELEASE_KEYSTORE_BASE64 != '' }} - run: | - echo "${{ secrets.RELEASE_KEYSTORE_BASE64 }}" | base64 -d > android/app/release.keystore - cat > android/keystore.properties << 'EOF' - RELEASE_STORE_FILE=release.keystore - RELEASE_STORE_PASSWORD=${{ secrets.RELEASE_STORE_PASSWORD }} - RELEASE_KEY_ALIAS=${{ secrets.RELEASE_KEY_ALIAS }} - RELEASE_KEY_PASSWORD=${{ secrets.RELEASE_KEY_PASSWORD }} - EOF - chmod 600 android/keystore.properties android/app/release.keystore + - name: 检查环境 + run: flutter doctor -v - - name: Make gradlew executable - run: chmod +x android/gradlew + - name: 安装项目依赖 + run: flutter pub get - - name: Build Beta APK - run: | - cd android - ./gradlew assembleRelease --parallel --build-cache --configure-on-demand + - name: 构建正式版APK + run: flutter build apk --release - - name: List generated APKs - run: | - echo "📱 Generated APK files:" - find android/app/build/outputs/apk/release -name "*.apk" -exec ls -lh {} \; - - - name: Upload Beta APKs + - name: 上传APK文件 uses: actions/upload-artifact@v4 with: - name: beta-apks-${{ needs.check-version.outputs.version }} - path: android/app/build/outputs/apk/release/*.apk - retention-days: 30 - - - name: Build Summary - run: | - echo "🎉 Beta build completed successfully!" - echo "📦 Version: ${{ needs.check-version.outputs.version }}" - echo "🚀 Triggered by: ${{ github.event_name }}" - echo "👤 Actor: ${{ github.actor }}" + name: my-apk + path: build/app/outputs/flutter-apk/app-release.apk From 02cd7bccfdc91e366c7fa84726c14c8807b61c01 Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 19:12:29 +0800 Subject: [PATCH 08/16] GitHub Actionsapk.yalm --- .github/workflows/build-beta.yml | 48 ++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-beta.yml b/.github/workflows/build-beta.yml index 7d0faa2b8..d670e797d 100644 --- a/.github/workflows/build-beta.yml +++ b/.github/workflows/build-beta.yml @@ -1,4 +1,4 @@ -name: 自动构建APK +name: 万能自动构建APK on: workflow_dispatch: @@ -8,29 +8,53 @@ jobs: steps: - uses: actions/checkout@v4 - - name: 安装 Java JDK + # 1. 自动安装 NodeJS (所有项目通用) + - name: 安装 NodeJS + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'yarn' + + # 2. 自动安装 Java (安卓打包必备) + - name: 安装 JDK 17 uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' - - name: 安装 Flutter 环境 + # 3. 自动安装 Flutter (可选,不影响其他项目) + - name: 安装 Flutter uses: subosito/flutter-action@v2 with: - flutter-version: '3.16.0' + flutter-version: 3.16.0 channel: stable - - name: 检查环境 - run: flutter doctor -v - + # 4. 通用依赖安装 - name: 安装项目依赖 - run: flutter pub get + run: | + if [ -f "pubspec.yaml" ]; then + flutter pub get + elif [ -f "yarn.lock" ]; then + yarn install + elif [ -f "package.json" ]; then + npm install + fi - - name: 构建正式版APK - run: flutter build apk --release + # 5. 通用打包命令 (自动识别项目类型) + - name: 开始打包APK + run: | + if [ -f "pubspec.yaml" ]; then + flutter build apk --release + elif [ -f "package.json" ]; then + yarn run build-app || npm run build-app || yarn run build:android || npm run build:android + fi - - name: 上传APK文件 + # 6. 自动上传APK (所有路径通用) + - name: 上传打包好的APK uses: actions/upload-artifact@v4 with: name: my-apk - path: build/app/outputs/flutter-apk/app-release.apk + path: | + build/app/outputs/flutter-apk/app-release.apk + release/*.apk + *.apk From 418d3154e724fcdd9cb8d3786618a3c58d7dce6a Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 19:16:37 +0800 Subject: [PATCH 09/16] Update build-beta.yml --- .github/workflows/build-beta.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-beta.yml b/.github/workflows/build-beta.yml index d670e797d..683607984 100644 --- a/.github/workflows/build-beta.yml +++ b/.github/workflows/build-beta.yml @@ -5,52 +5,55 @@ on: jobs: build: runs-on: ubuntu-latest + env: + # 强制使用 Node.js 24,解决弃用警告 + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true steps: - uses: actions/checkout@v4 - # 1. 自动安装 NodeJS (所有项目通用) - - name: 安装 NodeJS + # 1. 安装 Node.js 20(兼容你的项目) + - name: 安装 Node.js uses: actions/setup-node@v4 with: node-version: 20 cache: 'yarn' - # 2. 自动安装 Java (安卓打包必备) + # 2. 安装 JDK 17(安卓打包必备) - name: 安装 JDK 17 uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' - # 3. 自动安装 Flutter (可选,不影响其他项目) + # 3. 安装 Flutter(不影响 Node 项目) - name: 安装 Flutter uses: subosito/flutter-action@v2 with: flutter-version: 3.16.0 channel: stable - # 4. 通用依赖安装 + # 4. 自动识别项目类型并安装依赖 - name: 安装项目依赖 run: | if [ -f "pubspec.yaml" ]; then flutter pub get elif [ -f "yarn.lock" ]; then - yarn install + yarn install --frozen-lockfile elif [ -f "package.json" ]; then npm install fi - # 5. 通用打包命令 (自动识别项目类型) - - name: 开始打包APK + # 5. 自动识别打包命令 + - name: 构建APK run: | if [ -f "pubspec.yaml" ]; then flutter build apk --release elif [ -f "package.json" ]; then - yarn run build-app || npm run build-app || yarn run build:android || npm run build:android + yarn run build-app || npm run build-app || yarn run build:android || npm run build:android || echo "未找到Node项目打包命令" fi - # 6. 自动上传APK (所有路径通用) - - name: 上传打包好的APK + # 6. 自动上传所有路径的APK + - name: 上传APK uses: actions/upload-artifact@v4 with: name: my-apk From d761cfcee44399ffcae968749396d2f1c735787c Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 19:24:19 +0800 Subject: [PATCH 10/16] Update build-beta.yml --- .github/workflows/build-beta.yml | 52 +++++++------------------------- 1 file changed, 11 insertions(+), 41 deletions(-) diff --git a/.github/workflows/build-beta.yml b/.github/workflows/build-beta.yml index 683607984..718ffbdc1 100644 --- a/.github/workflows/build-beta.yml +++ b/.github/workflows/build-beta.yml @@ -1,4 +1,4 @@ -name: 万能自动构建APK +name: 构建 XlingMusic APK on: workflow_dispatch: @@ -6,58 +6,28 @@ jobs: build: runs-on: ubuntu-latest env: - # 强制使用 Node.js 24,解决弃用警告 FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true steps: - uses: actions/checkout@v4 - # 1. 安装 Node.js 20(兼容你的项目) + # 只装 Node,不装 Flutter(你的项目用不上) - name: 安装 Node.js uses: actions/setup-node@v4 with: node-version: 20 cache: 'yarn' - # 2. 安装 JDK 17(安卓打包必备) - - name: 安装 JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - # 3. 安装 Flutter(不影响 Node 项目) - - name: 安装 Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: 3.16.0 - channel: stable - - # 4. 自动识别项目类型并安装依赖 + # 安装依赖 - name: 安装项目依赖 - run: | - if [ -f "pubspec.yaml" ]; then - flutter pub get - elif [ -f "yarn.lock" ]; then - yarn install --frozen-lockfile - elif [ -f "package.json" ]; then - npm install - fi + run: yarn install --frozen-lockfile - # 5. 自动识别打包命令 - - name: 构建APK - run: | - if [ -f "pubspec.yaml" ]; then - flutter build apk --release - elif [ -f "package.json" ]; then - yarn run build-app || npm run build-app || yarn run build:android || npm run build:android || echo "未找到Node项目打包命令" - fi + # 构建 APK(用项目自带的命令) + - name: 构建 APK + run: yarn run build-app - # 6. 自动上传所有路径的APK - - name: 上传APK + # 正确上传 APK(只写项目实际会生成的路径) + - name: 上传 APK uses: actions/upload-artifact@v4 with: - name: my-apk - path: | - build/app/outputs/flutter-apk/app-release.apk - release/*.apk - *.apk + name: XlingMusic-APK + path: release/ From 72226a37dbd03ff2dcbec24e05b3bed13fd76f40 Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 19:27:57 +0800 Subject: [PATCH 11/16] Update build-beta.yml --- .github/workflows/build-beta.yml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-beta.yml b/.github/workflows/build-beta.yml index 718ffbdc1..b866ecdb6 100644 --- a/.github/workflows/build-beta.yml +++ b/.github/workflows/build-beta.yml @@ -1,32 +1,26 @@ -name: 构建 XlingMusic APK +name: 构建APK on: workflow_dispatch: jobs: build: runs-on: ubuntu-latest - env: - FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true steps: - uses: actions/checkout@v4 - # 只装 Node,不装 Flutter(你的项目用不上) - - name: 安装 Node.js + - name: 安装 Node.js 24 uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 24 # 这里改成 24,彻底解决弃用警告 cache: 'yarn' - # 安装依赖 - name: 安装项目依赖 - run: yarn install --frozen-lockfile + run: yarn install - # 构建 APK(用项目自带的命令) - - name: 构建 APK + - name: 构建APK run: yarn run build-app - # 正确上传 APK(只写项目实际会生成的路径) - - name: 上传 APK + - name: 上传APK uses: actions/upload-artifact@v4 with: name: XlingMusic-APK From 20d988ed90933ebb7de73f005f9f8daec2eab477 Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 19:30:19 +0800 Subject: [PATCH 12/16] Update build-beta.yml --- .github/workflows/build-beta.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-beta.yml b/.github/workflows/build-beta.yml index b866ecdb6..0ff8703fe 100644 --- a/.github/workflows/build-beta.yml +++ b/.github/workflows/build-beta.yml @@ -5,17 +5,22 @@ on: jobs: build: runs-on: ubuntu-latest + env: + # 只加这一行,彻底消除Node.js弃用警告 + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true steps: - uses: actions/checkout@v4 - name: 安装 Node.js 24 uses: actions/setup-node@v4 with: - node-version: 24 # 这里改成 24,彻底解决弃用警告 + node-version: 24 cache: 'yarn' - name: 安装项目依赖 - run: yarn install + run: | + yarn install --frozen-lockfile || yarn install + yarn add -D electron-builder - name: 构建APK run: yarn run build-app From 1df418b4e599e4a595a0ddaf6dd1f572ecef2822 Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 19:34:15 +0800 Subject: [PATCH 13/16] Update build-beta.yml --- .github/workflows/build-beta.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-beta.yml b/.github/workflows/build-beta.yml index 0ff8703fe..d74598881 100644 --- a/.github/workflows/build-beta.yml +++ b/.github/workflows/build-beta.yml @@ -2,25 +2,23 @@ name: 构建APK on: workflow_dispatch: +# 按官方要求:全局强制使用 Node24 +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + jobs: build: runs-on: ubuntu-latest - env: - # 只加这一行,彻底消除Node.js弃用警告 - FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true steps: - uses: actions/checkout@v4 - - name: 安装 Node.js 24 + - name: 安装 Node.js uses: actions/setup-node@v4 with: node-version: 24 - cache: 'yarn' - name: 安装项目依赖 - run: | - yarn install --frozen-lockfile || yarn install - yarn add -D electron-builder + run: yarn install - name: 构建APK run: yarn run build-app From 858b884ebc0f510b30ce1113ec4e03ed007c2a7b Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 19:37:48 +0800 Subject: [PATCH 14/16] Update build-beta.yml --- .github/workflows/build-beta.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-beta.yml b/.github/workflows/build-beta.yml index d74598881..a8dcd93c0 100644 --- a/.github/workflows/build-beta.yml +++ b/.github/workflows/build-beta.yml @@ -2,7 +2,6 @@ name: 构建APK on: workflow_dispatch: -# 按官方要求:全局强制使用 Node24 env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true @@ -16,12 +15,19 @@ jobs: uses: actions/setup-node@v4 with: node-version: 24 + cache: 'yarn' - name: 安装项目依赖 run: yarn install + # 自动尝试所有常见的打包命令,总有一个能命中 - name: 构建APK - run: yarn run build-app + run: | + yarn run build:android || \ + yarn run build || \ + npm run build:android || \ + npm run build || \ + echo "没有找到可用的打包命令,请检查 package.json 里的 scripts" && exit 1 - name: 上传APK uses: actions/upload-artifact@v4 From 6d98d7e25ba72a4bbc9b7a28b629f12e647d5443 Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 19:44:54 +0800 Subject: [PATCH 15/16] Update build-beta.yml --- .github/workflows/build-beta.yml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-beta.yml b/.github/workflows/build-beta.yml index a8dcd93c0..275ec788c 100644 --- a/.github/workflows/build-beta.yml +++ b/.github/workflows/build-beta.yml @@ -2,35 +2,42 @@ name: 构建APK on: workflow_dispatch: +# 官方强制全程 Node24,消除弃用警告 env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true jobs: build: runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 - - name: 安装 Node.js + # 1. 装 JDK 安卓打包必须 + - name: 安装 JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # 2. 装 Node24 匹配你项目 engines >=18 + - name: 安装 Node.js 24 uses: actions/setup-node@v4 with: node-version: 24 cache: 'yarn' + # 3. 安装依赖 - name: 安装项目依赖 run: yarn install - # 自动尝试所有常见的打包命令,总有一个能命中 - - name: 构建APK - run: | - yarn run build:android || \ - yarn run build || \ - npm run build:android || \ - npm run build || \ - echo "没有找到可用的打包命令,请检查 package.json 里的 scripts" && exit 1 + # 4. 用你 package.json 里真实存在的命令 build-android + - name: 构建安卓正式包 + run: npm run build-android + # 5. RN 安卓打包后 APK 固定路径 - name: 上传APK uses: actions/upload-artifact@v4 with: - name: XlingMusic-APK - path: release/ + name: MusicFree-APK + path: android/app/build/outputs/apk/release/app-release.apk From 15d0731abc124730e336d9b86fe2997bc1c6568d Mon Sep 17 00:00:00 2001 From: YixingTRD2943 <2943670672@qq.com> Date: Tue, 5 May 2026 19:48:05 +0800 Subject: [PATCH 16/16] Update build-beta.yml --- .github/workflows/build-beta.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-beta.yml b/.github/workflows/build-beta.yml index 275ec788c..8708313f1 100644 --- a/.github/workflows/build-beta.yml +++ b/.github/workflows/build-beta.yml @@ -2,7 +2,6 @@ name: 构建APK on: workflow_dispatch: -# 官方强制全程 Node24,消除弃用警告 env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true @@ -13,30 +12,36 @@ jobs: steps: - uses: actions/checkout@v4 - # 1. 装 JDK 安卓打包必须 + # 安装 JDK(安卓打包必须) - name: 安装 JDK 17 uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' - # 2. 装 Node24 匹配你项目 engines >=18 + # 安装 Node.js 24 - name: 安装 Node.js 24 uses: actions/setup-node@v4 with: node-version: 24 cache: 'yarn' - # 3. 安装依赖 - - name: 安装项目依赖 + # 安装项目依赖 + - name: 安装依赖 run: yarn install - # 4. 用你 package.json 里真实存在的命令 build-android - - name: 构建安卓正式包 - run: npm run build-android + # 关键:给 gradlew 加执行权限(Linux 必须) + - name: 赋予 gradlew 执行权限 + run: chmod +x ./android/gradlew - # 5. RN 安卓打包后 APK 固定路径 - - name: 上传APK + # 直接用 Linux 原生命令打包,绕开 package.json 里的 Windows 命令 + - name: 构建 Release APK + run: | + cd android + ./gradlew assembleRelease + + # 上传正确路径的 APK + - name: 上传 APK uses: actions/upload-artifact@v4 with: name: MusicFree-APK