FEA-Bench / testbed /aws-powertools__powertools-lambda-python /.github /actions /upload-artifact /action.yml
| name: Upload artifact | |
| description: Wrapper around GitHub's official action, with additional archiving before upload | |
| # PROCESS | |
| # | |
| # 1. Creates tarball excluding .git files | |
| # 2. Uploads tarball using actions/upload-artifact action, fail CI job if no file is found | |
| # 3. Remove archive after uploading it. | |
| # NOTES | |
| # | |
| # Upload-artifact and download-artifact takes ~2m40s to upload 8MB | |
| # so this is custom action cuts down the entire operation to 1s | |
| # by uploading/extracting a tarball while relying on the official upload-artifact/download-artifact actions | |
| # | |
| # USAGE | |
| # | |
| # NOTE: Meant to be used with ./.github/actions/download-artifact | |
| # | |
| # - name: Upload sealed source code | |
| # uses: ./.github/actions/upload-artifact | |
| # with: | |
| # name: ${{ steps.integrity.outputs.INTEGRITY_HASH }} | |
| # path: . | |
| # https://github.com/actions/upload-artifact/blob/main/action.yml | |
| inputs: | |
| name: | |
| description: Artifact name | |
| required: true | |
| path: | |
| description: > | |
| A file, directory or wildcard pattern that describes what to upload. | |
| You can pass multiple paths separated by space (e.g., dir1 dir2 file.txt). | |
| Paths and wildcard patterns must be tar command compatible. | |
| required: true | |
| retention-days: | |
| description: > | |
| Artifact retention in days. By default 1 day, max of 90 days, and 0 honours default repo retention. | |
| You can change max days in the repository settings. | |
| required: false | |
| default: "1" | |
| if-no-files-found: | |
| description: > | |
| Action to perform if no files are found: warn, error, ignore. By default, it fails fast with 'error'. | |
| Options: | |
| warn: Output a warning but do not fail the action | |
| error: Fail the action with an error message | |
| ignore: Do not output any warnings or errors, the action does not fail | |
| required: false | |
| default: error | |
| runs: | |
| using: composite | |
| steps: | |
| - name: Archive artifacts | |
| run: | | |
| tar --exclude-vcs \ | |
| -cvf "${ARCHIVE}" "${PATH_TO_ARCHIVE}" | |
| env: | |
| ARCHIVE: ${{ inputs.name }}.tar | |
| PATH_TO_ARCHIVE: ${{ inputs.path }} | |
| shell: bash | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
| with: | |
| if-no-files-found: ${{ inputs.if-no-files-found }} | |
| name: ${{ inputs.name }} | |
| path: ${{ inputs.name }}.tar | |
| retention-days: ${{ inputs.retention-days }} | |
| - name: Remove archive | |
| run: rm -f "${ARCHIVE}" | |
| env: | |
| ARCHIVE: ${{ inputs.name }}.tar | |
| shell: bash | |