func UploadAssets(app *parser.MobileApp, bucket, destBaseDir string) ([]string, error) {
	buildDir := destBaseDir + "/" + app.Version + "/" + app.Build
	appIconPath := buildDir + "/" + parser.AppIconFile
	appSitePath := buildDir + "/" + filepath.Base(app.File)
	appIndexHTMLSitePath := buildDir + "/" + parser.IndexHTMLFile
	bucketHTTPSurl := "https://" + bucket + ".s3.amazonaws.com"
	app.DownloadURL = bucketHTTPSurl + "/" + appSitePath
	assetsDir := parser.AndroidAssetsDir
	var appPlistSitePath string
	if app.IsIOS() {
		assetsDir = parser.IOSAssetsDir
		appPlistSitePath = buildDir + "/" + parser.IOSPlistFile
		app.PlistURL = htmltemp.URL(bucketHTTPSurl + "/" + appPlistSitePath)
	}
	assets := []string{}
	if err := app.GenerateAssets(); err != nil {
		return assets, err
	}
	uploads := []Upload{
		{bucket, assetsDir + "/" + parser.AppIconFile, appIconPath},
		{bucket, assetsDir + "/" + parser.VersionJsonFile, destBaseDir + "/" + app.Version + "/" + parser.VersionJsonFile},
		{bucket, assetsDir + "/" + parser.IndexHTMLFile, appIndexHTMLSitePath},
		{bucket, app.File, appSitePath},
	}
	if app.IsIOS() {
		uploads = append(uploads, Upload{bucket, assetsDir + "/" + parser.IOSPlistFile, appPlistSitePath})
	}
	for _, upload := range uploads {
		fileURL, err := UploadFile(upload)
		if err != nil {
			return assets, err
		}
		decodedURL, err := url.QueryUnescape(fileURL)
		if err != nil {
			return assets, err
		}
		assets = append(assets, decodedURL)
	}
	return assets, nil
}
UploadAssets uploads the generated files by the parser package along with the ipa or apk file.
It accepts a struct of type *parser.MobileApp and the destination base directory of the s3 bucket.
It returns a slice of aws s3 files url.
package s3
import (
	"bytes"
	"fmt"
	"net/http"
	"net/url"
	"os"
	"path/filepath"
	"strings"
	htmltemp "html/template"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/s3/s3manager"
	"github.com/bzon/gota/parser"
)
type Upload struct {
	Bucket, SrcFile, DestFilePath string
}
func UploadFile(upload Upload) (string, error) {
	f, err := os.Open(upload.SrcFile)
	if err != nil {
		return "", err
	}
	defer f.Close()
	fileInfo, _ := f.Stat()
	var size int64 = fileInfo.Size()
	buffer := make([]byte, size)
	_, err = f.Read(buffer)
	if err != nil {
		return "", err
	}
	contentType := http.DetectContentType(buffer)
	if strings.Contains(upload.SrcFile, "html") {
		contentType = "text/html"
	}
	sess := session.Must(session.NewSession())
	uploader := s3manager.NewUploader(sess)
	result, err := uploader.Upload(&s3manager.UploadInput{
		ACL:    aws.String("public-read"),
		Bucket: aws.String(upload.Bucket),
		Key:    aws.String(upload.DestFilePath),
		Body:                 bytes.NewReader(buffer),
		ContentType:          aws.String(contentType),
		ServerSideEncryption: aws.String("AES256"),
	})
	if err != nil {
		return "", fmt.Errorf("failed to upload file, %v", err)
	}
	return aws.StringValue(&result.Location), nil
}