Ibra
Ibra

Reputation: 1072

Using github actions to create a folder and upload it to a destination

Im running a job that creates a folder dist and another job that depends on the first one to be completed successfully to upload the dist folder. However I'm getting an error when uploading saying the directory doesn't exist, while it works to create the folder locally and push it to github. I don't want to push the folder to my repo is there a way to work?

name: Build Artifcats and Upload To Azure Blob Storage
on:
  push:
    branches:
      - main

jobs:
  build_on_win:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@master
      with:
        node-version: 14.2.0
Running Scripts**......... 

  upload:
    runs-on: ubuntu-latest
    needs: build_on_win   (Notice here I'm waiting for the artifacts to be built)
    steps:
      - uses: actions/checkout@v2
      - uses: bacongobbler/[email protected]
        with:
          source_dir: ./solutions/app/dist
          container_name: 'app/latest'
          connection_string: .......
          sync: true
  

Upvotes: 2

Views: 5768

Answers (1)

GuiFalourd
GuiFalourd

Reputation: 22900

Folders (and files) aren't shared between jobs.

To achieve what you want, you will need to upload the dist directory as an artifact (using the upload action then download this artifact on the second job with the download action before performing the action you want on the second job.

You can find more information on the GHA official documentation.

Upvotes: 3

Related Questions