softprops / action-gh-release

📦 :octocat: GitHub Action for creating GitHub Releases
MIT License
4.14k stars 451 forks source link

How to upload asses after completion of both Windows and Linux run #256

Open wxguy opened 2 years ago

wxguy commented 2 years ago

Here is my current setup I use for action:

on: [push]

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]

    runs-on: ${{ matrix.os }}

In my case, windows run takes much more time to complete and build the executable than Linux VM. In such cases, how do I wait for Windows VM to complete the job and trigger the upload process to github release?

konsumer commented 2 years ago

I also have a similar question. I am not using matrix but I have windows, mac, linux (x86_64, arm7, and arm64) builds and I want to attach them all to a single release. I tried this:

jobs:
  publish:
    runs-on: ubuntu-latest
    needs: [windows, mac, linux]
    steps:
      - name: zip windows
        run: |
          cd build-windows-x86_64
          zip ../my_raylib_game-windows.zip my_raylib_game.exe
      - name: zip mac
        run: |
          cd build-mac-universal
          zip ../my_raylib_game-mac.zip my_raylib_game
      - name: zip linux-x86_64
        run: |
          cd build-linux-x86_64
          zip ../my_raylib_game-linux-x86_64.zip my_raylib_game
      - name: zip linux-arm64
        run: |
          cd build-linux-arm64
          zip ../my_raylib_game-linux-arm64.zip my_raylib_game
      - name: zip linux-arm7
        run: |
          cd build-linux-arm7
          zip ../my_raylib_game-linux-arm7.zip my_raylib_game
      - name: create_release
        uses: softprops/action-gh-release@v1
        with:
          files: |
            my_raylib_game-windows.zip
            my_raylib_game-mac.zip
            my_raylib_game-linux-x86_64.zip
            my_raylib_game-linux-arm64.zip
            my_raylib_game-linux-arm7.zip

  windows:
    # some build steps, first step is actions/checkout@v2
  mac:
    # some build steps, first step is actions/checkout@v2
  linux:
    # some build steps, first step is actions/checkout@v2

First it runs all the builds, but then the zip steps don't work. I tried sharing the actions/checkout@v2 between all steps with a needs in each build-step, but then the builds don't work because it doesn't seem to share the filesystem.

Am I thinking about this wrong?

konsumer commented 2 years ago

I did something similar here, where I create the release, then used the upload_url and actions/upload-release-asset to attach them all, but I'm not sure how to do that here.

Frederick888 commented 2 years ago

actions/upload-release-asset is not maintained any more and causes lots of warnings due to the recent set-output deprecation.

I migrated to https://github.com/shogo82148/actions-upload-release-asset

konsumer commented 2 years ago

I ended up solving my usecase with create_release/actions/upload-release-asset@v1

backwardsEric commented 1 year ago

One approach, not specific to action-gh-release is to use artifacts (see https://github.com/actions/upload-artifact and https://github.com/actions/download-artifact ) to communicate the built stuff from earlier stages to a later stage that invokes action-gh-release to build the release. An example of a workflow that does that, though probably overly complicated for what you want, is at https://github.com/angband/angband/blob/master/.github/workflows/release.yaml .