Search code examples
github-actionsunzip

How to automate release drafting from archive uploaded by the `actions/upload-artifact@v3` action?


I'm currently attempting to automate the creation of GitHub releases. The automation I attempted to use here:

  publish:
    runs-on: ubuntu-20.04
    needs: build
    steps:
      - name: Download artifact
        uses: actions/download-artifact@v2
        with:
          name: release_artifacts
          path: ${{ github.workspace }}/release_artifacts.zip

      - name: Extract artifacts for release upload
        run: |
          mkdir ${{ github.workspace }}/pkg
          ls ${{ github.workspace }}
          unzip ${{ github.workspace }}/release_artifacts.zip -d ${{ github.workspace }}/pkg/

runs into an issue where it cannot find archive that the ls command and absolute path clearly show exists in this log:

> mkdir /home/runner/work/relaymono/relaymono/pkg
> ls /home/runner/work/relaymono/
pkg
release_artifacts.zip
> unzip /home/runner/work/relaymono/relaymono/release_artifacts.zip -d /home/runner/work/relaymono/relaymono/pkg/
unzip:  cannot find or open /home/runner/work/relaymono/relaymono/release_artifacts.zip, /home/runner/work/relaymono/relaymono/release_artifacts.zip.zip or /home/runner/work/relaymono/relaymono/release_artifacts.zip.ZIP.
Error: Process completed with exit code 9.

I've tried several permutations of paths starting with relative paths and ending where it is now. I expected that the unzip script here would result in extracting the release_artifacts.zip archive into the pkg/ dir, allowing them to be updated to the later release.


Solution

  • Please notice that download step already unzipped your zip file

    drwxr-xr-x 2 runner docker 4096 Aug 14 06:58 pkg
    drwxr-xr-x 2 runner docker 4096 Aug 14 06:58 release_artifacts.zip