Skip to content

A deployment method for Publish to upload files to AWS S3

Notifications You must be signed in to change notification settings

JohnBehnke/S3PublishDeploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S3PublishDeploy

A deployment method for Publish to upload files using to a S3.

Preface

If you want to learn how to configure a S3 bucket for static site hosting, you can learn how to here

Ensure you have the AWS CLI installed and configured. You should have a file located at ~/.aws/config that contains a default AWS region. You should also have a file located at ~/.aws/credentials that contains your Access Key Id and Secret Access Key. _

Download and installation for the AWS CLI are located here

Installation

Add S3PublishDeploy to your Package.swift file.

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/johnbehnke/s3publishdeploy", from: "0.1.0")
    ],
    targets: [
        .target(
            ...
            dependencies: [
                ...
                "S3PPublishDeploy"
            ]
        )
    ]
    ...
)

Usage

You can then declare your deployment method in your pipeline:

import S3PublishDeploy
...
try Website().publish(using: [
    ...
    .deploy(using: .s3(bucket: "my-test-bucket))
])

By default, the package assumes you have the AWS CLI installed at /usr/local/bin/aws. If you want to provide a different AWS binary, you can pass the pathToAWSBinary and give the full path to the binary.

By defualt, the package will deploy using the sync argument set to true. This will ensure the state of the S3 bucket matches the state of the Output directory exactly. If you have files in your bucket that are not present in your static site directory and you don't want those files to be removed, set the sync argument to false.

Acknowledgement

Thanks to John Sundell (@johnsundell) for creating Publish

License

MIT License

About

A deployment method for Publish to upload files to AWS S3

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages