File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ Source for [bytesized.co](https://www.bytesized.co).
44bytesized.co is statically generated using [ Publish] ( https://github.com/JohnSundell/Publish ) , a static site generator written in Swift.
55
66## Publishing to S3
7- ```
8- swift run -c release
9- aws s3 sync Output/. s3://<Bucket> --exclude "*.DS_Store*"
7+ ``` bash
8+ swift run -c release bytesized --deploy
109```
Original file line number Diff line number Diff line change 11import Foundation
22import Publish
33import Plot
4+ import ShellOut
45
56struct Bytesized : Website {
67 enum SectionID : String , WebsiteSectionID {
@@ -53,5 +54,16 @@ try Bytesized().publish(using: [
5354 }
5455 }
5556 } ,
56- . generateHTML( withTheme: . bytesized, fileMode: . standAloneFiles)
57+ . generateHTML( withTheme: . bytesized, fileMode: . standAloneFiles) ,
58+ . deploy( using: . s3( " bytesized.co " ) )
5759] )
60+
61+ public extension DeploymentMethod {
62+ // Requires AWS CLI to be installed
63+ static func s3( _ bucket: String ) -> Self {
64+ DeploymentMethod ( name: " S3 ( \( bucket) ) " ) { context in
65+ let s3 = try context. createDeploymentFolder ( withPrefix: " s3_ " , configure: { _ in } )
66+ try shellOut ( to: " aws s3 sync \( s3. path) s3:// \( bucket) --exclude \" *.DS_Store* \" " , outputHandle: FileHandle . standardOutput)
67+ }
68+ }
69+ }
You can’t perform that action at this time.
0 commit comments