为什么 upload-release-asset github 操作失败

问题描述 投票:0回答:1

我有一个 yml 文件可以自动构建和上传我们的 2d 统一项目。构建已上传并作为工件正常运行,但是当我尝试使用该工件作为发布资产进行正式发布时,它仅包含我存储库的源代码并且我收到错误消息:

/build/Galactic.zip doesn't match any files
Galactic.zip doesn't match any files

这是我们的yml文件:

name: Building and Testing 😎

on:
  push:
    branches:
      - cd-testing
      - main
      - build-fix
      - unity-cd
      
jobs:
  build:
    name: Build my project  ✨
    runs-on: ubuntu-latest
    steps:
      # Checkout
      - name: Checkout repository
        uses: actions/checkout@v2
        with:
          lfs: true

      # Cache
      - name: Cache
        uses: actions/cache@v2
        with:
          path: PlatformerStealthGame/Library
          key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
          restore-keys: |
            Library-PlatformerStealthGame-
            Library-
            
      # Build
      - name: Build project
        uses: game-ci/unity-builder@v2
        env:
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
          UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
        with:
          projectPath: PlatformerStealthGame
          targetPlatform: StandaloneWindows
      - uses: actions/upload-artifact@v2
        with:
          name: Galactic
          path: /build

      # Unity Return License
      - name: Unity - Return License
        uses: game-ci/[email protected]      

      # Test
      - name: Run tests
        uses: game-ci/unity-test-runner@v2
        env:
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
          UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
        with:
          projectPath: PlatformerStealthGame
          githubToken: ${{ secrets.GITHUB_TOKEN }}     
          # targetPlatform: WebGL     
          
      # Unity Return License
      - name: Unity - Return License
        uses: game-ci/[email protected]          
          
      # Release
      - name: Automatic Releases
        uses: marvinpinto/[email protected]
        with:
          repo_token: "${{ secrets.GITHUB_TOKEN }}"
          automatic_release_tag: "latest"
          prerelease: false
          title: "Development Build"
          files: |
             /build/Galactic.zip
             Galactic.zip
             *.zip
            
      # Unity Return License
      - name: Unity - Return License
        uses: game-ci/[email protected]

我已经更改了版本的名称,以便每次使用提交名称时它都是唯一的,但这并没有解决错误。

github yaml continuous-integration github-actions continuous-deployment
1个回答
0
投票

您正在尝试在使用工作流引用作为标签名称的工作流中创建发布标签。

- name: Automatic Releases
  id: create_release
  uses: actions/create-release@v1
  with:
    tag_name: ${{ github.ref }}

但是因为你的工作流触发事件,ref会是一个分支名

on:
  push:
    branches:
      - cd-testing
      - main
      - build-fix

git 存储库上的引用必须是唯一的,因此您不能创建使用现有分支名称的标签。相反,您可以尝试为每个发布标签生成一个唯一的版本号。

© www.soinside.com 2019 - 2024. All rights reserved.