actions / upload-artifact

MIT License
3.26k stars 739 forks source link

Unable to pass artifact to S3 GHA #377

Open adefemi171 opened 1 year ago

adefemi171 commented 1 year ago

What happened?

I created two different jobs where one creates the artifact and another download the artifact. For the job that download the artifact, it also need to upload the artifact to S3. When I try to upload the artifact, I get the error path not found.

What did you expect to happen?

I want to be able to see the artifact in the specified path and upload the artifact as well to S3.

How can we reproduce it?

The workflow file is attached below:

name: 'Upload Web App Artifacts to s3'
on:
    push:
        branches:
            - master
env:
    FORCE_COLOR: 3
    AWS_REGION: 'us-east-1'
jobs:
    build_artifacts:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v2
            - name: Use Node.js 14
              uses: actions/setup-node@v1
              with:
                  node-version: 14
            - uses: actions/cache@v2
            - name: 'Build App'
              run: cd packages/app && yarn run build
              env:
                  GITHUB_SHA: ${{ env.GITHUB_SHA }}
            - name: 'Archive Artifacts'
              uses: actions/upload-artifact@v3.1.1
              with:
                  name: web-app-artifacts
                  path: packages/app/dist/ # we could use env ${{ env.artifactPath }}
                  retention-days: 1 # we can set retention days
                  if-no-files-found: error
    upload_artifacts_to_s3:
        needs: build_artifacts
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v2
            - name: 'Download Artifacts'
              id: artifacts-download
              uses: actions/download-artifact@v3.0.1
              with:
                  name: web-app-artifacts
                  path: packages/app/
            - name: 'Check Home path'
              run: ls ${{steps.artifacts-download.outputs.download-path}}
            - name: 'Push Artifacts to S3'
              uses: jakejarvis/s3-sync-action@master
              with:
                  args: --acl public-read --follow-symlinks --delete
              env:
                  AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
                  AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
                  AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
                  AWS_REGION: ${{ env.AWS_REGION }}
                  SOURCE_DIR: 'packages/app/web-app-artifacts' # optional: defaults to entire repository

Anything else we need to know?

No response

What version of the action are you using?

v3.0.1

What are your runner environments?

linux

Are you on GitHub Enterprise Server? If so, what version?

No response