Building for macOS completes, but is corrupt

I have written a GitHub Action that is triggered on release and then attaches the resultant binary to the release. This works, but when I try to run the resultant app it is flagged as corrupt.

Running the same steps on my local macOS 11 install results in a non-corrupt app that executes.

Can anyone suggest what is going wrong?

The action:

    types: [created]
    # Sequence of patterns matched against refs/tags
    - '[0-9]+.*' # Push events to matching 1.0, 2.0, 1.0.1-alpha

name: Attach macOS binary

    name: Build and attach binary
    runs-on: macos-11.0
      - name: Checkout code
        uses: actions/checkout@v2
          ref: ${{ github.ref }}
          submodules: recursive
      - name: Show readme
        run: cat
      - name: Setups variables
        run: |
          echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
          echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
      - name: Update version and date in project
        run: |
          echo VERSION=$VERSION
          echo DATE=$DATE
          sed -i '' 's/20191017/'${DATE}'/g' Boxer.xcodeproj/project.pbxproj
          sed -i '' 's/2.0.0-alpha/'${VERSION}'/g' Boxer.xcodeproj/project.pbxproj
      - name: Update versions for Finder
        run: agvtool new-marketing-version ${VERSION}
      - name: Build the project
        run: xcodebuild -derivedDataPath ./build -workspace Boxer.xcworkspace -scheme "Boxer CI" -configuration "Release"
      - name: Package the release artefacts
        run: |
          hdiutil create -volname Boxer -srcfolder build/Build/Products/Release/ -ov -format UDZO Boxer.dmg
      - name:  Upload binaries to release
        uses: svenstaro/upload-release-action@v2
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          tag: ${{ github.ref }}
          file: ./Boxer.dmg
          asset_name: Boxer.dmg
          overwrite: true

In context of my current development branch:

My first thought was that this could be related to the deployment target version, but if I understand correctly, then you use a macOS 11 runner for building the application and the resulting binary does not run on your local macOS 11 system, whereas but performing the same steps on your local machine results in a working binary. I would only expect issues if the host system and the macOS target version that you use when compiling were higher than the macOS version of the machine that you later try to run the app on.

It might still be an issue related to the SDK, but I’m not sure what it could be. Is there a difference between architectures, e.g. x86-64 vs. ARM?