Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: option to upload artifact on ci workflow #342

Open
Ludea opened this issue Dec 12, 2022 · 7 comments
Open

enhancement: option to upload artifact on ci workflow #342

Ludea opened this issue Dec 12, 2022 · 7 comments

Comments

@Ludea
Copy link
Contributor

Ludea commented Dec 12, 2022

For now I use https://github.com/actions/upload-artifact to do the job.

It can be usefull to add an option to do the same thing.

WDYT ?

@FabianLars
Copy link
Member

Since this is probablyyy a niche feature, i think i'd prefer if the action would output the paths of the generated bundles instead. This would be way more flexible and could cover more use cases. any thoughts about that?

@Ludea
Copy link
Contributor Author

Ludea commented Dec 12, 2022

it's an alternative solution, why not

@Ludea Ludea closed this as completed Dec 12, 2022
@Ludea Ludea reopened this Dec 14, 2022
@Ludea
Copy link
Contributor Author

Ludea commented Dec 14, 2022

I reopen, because after some thoughts, I would like to add short commit into assets name, to avoid confusion with release assets

@septum
Copy link

septum commented Jun 20, 2023

This is slightly related, but seems like a good place to ask this: Do the artifacts stick around after the action ends? I ask this because we are having trouble sending them to an S3 bucket, with the error output stating that the path does not exist.

@FabianLars
Copy link
Member

Yes they do, but only for the following steps of the current jobs, other jobs won't have access to it.
Also, the action will return the paths of the artifacts as a json string which you may be able to use (though if you know your project the paths are pretty easy to predict).

@martpie
Copy link

martpie commented Mar 29, 2024

I would like to second the ability to upload artifacts without having to rely on releases. I very frequently build all binaries as part of a PR, and it is really nice to be able to go to a run artifacts section and download binaries from there (for testers, etc).

Example: https://github.com/martpie/museeks/actions/runs/8484717113

image

@brianz
Copy link

brianz commented Aug 15, 2024

For anyone who comes here looking to upload artifacts to other locations, here is how I solved it to upload to S3.

It's fairly simple once you understand that the artifactPaths is json-encoded array of absolute file paths. In any subsequent upload step, you need to decode it and then upload each item. As seen below, you can do this using jq which is available by default.

This also becomes trickier with Windows builds that output paths like D:\\a\\myapp-sveltekit\\myapp-sveltekit\\src-tauri\\target\\release\\bundle\\msi\\MyApp_5.0.3_x64_en-US.msi. ChatGPT gave me the solution using Powershell which worked on the first try.

      - uses: tauri-apps/tauri-action@v0
        id: build
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
          APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
          APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
          APPLE_ID: ${{ secrets.APPLE_ID }}
          APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
          APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}

        with:
          # Comment out tagName and releaseName to prevent automatically uploading to GH
          # tagName: myapp-v__VERSION__ 
          # releaseName: 'MyApp v__VERSION__'
          includeUpdaterJson: false
          releaseBody: 'See the assets to download this version and install.'
          releaseDraft: true
          prerelease: false
          includeDebug: true
          args: ${{ matrix.settings.args }}

      - name: Upload artifacts to AWS S3
        if: matrix.settings.platform == 'macos-latest'
        run: |
          paths=$(echo '${{ steps.build.outputs.artifactPaths }}' | jq -c '.[]' | sed 's/"//g')
          for fn in $paths; do
            if [[ -f $fn ]]; then
              echo "Uploading $fn"
              aws s3 cp $fn s3://myBucketName/
            fi
          done

      - name: Upload artifacts to AWS S3 (Windows)
        if: matrix.settings.platform == 'windows-latest'
        shell: pwsh
        run: |
          $jsonString = '${{ steps.build.outputs.artifactPaths }}'
          $filePaths = ConvertFrom-Json $jsonString
          foreach ($path in $filePaths) {
            if (Test-Path $path -PathType Leaf) {
              Write-Host "Uploading $path"
              aws s3 cp $path s3://myBucketName/
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants