samuelmeuli / action-electron-builder

:electron: GitHub Action for building and releasing Electron apps
MIT License
658 stars 201 forks source link

Upload build artifacts #14

Closed samuelmeuli closed 4 years ago

samuelmeuli commented 4 years ago

The action should upload the packaged apps to GitHub (if such an API is already available) or at least give predictable names to the files so they can be uploaded with https://github.com/actions/upload-artifact.

See the previous discussion in #12.

PRs are welcome :)

leclercb commented 4 years ago

After some tests, it might actually not be needed. When the GitHub upload-artifact action will support pattern/regex/globs it will be easier, but it is already possible to make something useful.

The most simple is adding this at the end of the script, but be aware that it will create one big file which can quickly take more than 1go

  - name: Upload Artifacts
    uses: actions/upload-artifact@v1
    with:
      name: my-app
      path: dist

Or better version is this one, which will only take the binaries and not the unpacked folders and create an artifact per platform:

  - name: Move Files
    shell: bash
    run: ./move_dist.sh

  - name: Upload Linux Artifacts
    uses: actions/upload-artifact@v1
    with:
      name: my-app-linux
      path: dist-linux

  - name: Upload Mac Artifacts
    uses: actions/upload-artifact@v1
    with:
      name: my-app-mac
      path: dist-mac

  - name: Upload Win Artifacts
    uses: actions/upload-artifact@v1
    with:
      name: my-app-win
      path: dist-win

The move_dist.sh file:

#!/bin/bash

mkdir dist-linux dist-mac dist-win > /dev/null 2>&1

mv dist/latest-linux.yml dist/*.AppImage dist/*.tar.gz dist/*.snap dist-linux > /dev/null 2>&1
mv dist/latest-mac.yml dist/*.dmg dist/*.dmg.blockmap dist-mac > /dev/null 2>&1
mv dist/latest.yml dist/*.exe dist/*.exe.blockmap dist-win > /dev/null 2>&1

exit 0

I think this issue can be closed :)