Skip to content

GitHub action to upload files in S3 bucket

License

Notifications You must be signed in to change notification settings

agilecustoms/publish-s3

Repository files navigation

publish-s3

GitHub Action to upload objects to Amazon S3. Intended to be used only as part of GH action agilecustoms/release

Main features:

  • Set content type (MIME type) to serve files from the "website" bucket
  • In normal mode adds tag Release=true, in dev-mode adds tag: Release=false. This allows automatic removals. Read more about release types
  • Ability to upload in several dirs to support semantic versioning: /myservice/1.2.4, /myservice/1.2, /myservice/1, /myservice/latest
  • To avoid clutter, the directories are first cleaned up, and then files uploaded

Usage

Code below is not a real usage, but rather a block of code from publish action. Parameters are not documented: part of them are pass through from publish action, the other part is generated by publish action

- name: Upload in S3
  if: steps.init.outputs.aws_s3
  uses: agilecustoms/publish-s3@v1
  with:
    access-key-id: ${{ steps.login-aws.outputs.aws-access-key-id }}
    secret-access-key: ${{ steps.login-aws.outputs.aws-secret-access-key }}
    session-token: ${{ steps.login-aws.outputs.aws-session-token }}
    bucket: ${{ inputs.aws-s3-bucket }}
    bucket-dir: ${{ inputs.aws-s3-dir }}
    versions: ${{ steps.version.outputs.tags }}
    dev-release: ${{ inputs.dev-release }}

Inputs

Name Required Description
access-key-id Yes AWS access key ID for authentication
bucket Yes S3 bucket name where files will be uploaded
bucket-dir No S3 bucket directory path. Files will be uploaded to bucket/bucket-dir/repo-name/version/. Can be empty string for root level
dev-release No If true, uploads with tag Release=false for dev/temporary releases. If false or empty, uploads with tag Release=true for production releases
secret-access-key Yes AWS secret access key for authentication
session-token Yes AWS session token for authentication
versions Yes Space-separated list of versions to upload. Examples: 1.2.4 1.2 1 latest for semantic versioning, or 2.0-beta fix-135 for custom versions

About

GitHub action to upload files in S3 bucket

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •