WoJ
WoJ

Reputation: 30074

How to address the artifact I want to upload?

I am using Actions to compile an executable and then upload it:

name: note
on: push
jobs:
  cli:
    runs-on: windows-latest
    defaults:
      run:
        working-directory: ./cli
    steps:
      - uses: actions/checkout@master
      - run: go build -v
      - run: dir
      - name: upload cli.exe
        uses: actions/upload-artifact@v2
        with:
          name: cli.exe
          path: cli.exe

This results in:

enter image description here

The dir command shows that cli.exe is there, but it seems that I do not address it correctly for the upload. How to fix that?

Upvotes: 0

Views: 236

Answers (1)

WoJ
WoJ

Reputation: 30074

The path of the upload must be provided from the root of the checked-out repo. In my case, the upload section needs therefore to be

- name: upload cli.exe
    uses: actions/upload-artifact@v2
    with:
      name: cli.exe
      path: cli/cli.exe

In other words, actions/upload-artifact does not take into account the working-directory setting.

Upvotes: 2

Related Questions