code: def publish(endpoint, purge_files, rebuild_manifest, skip_upload):
      
      print("Publishing site to %s ..." % endpoint.upper())
  
      yass = Yass(CWD)
      target = endpoint.lower()
  
      sitename = yass.sitename
      if not sitename:
          raise ValueError("Missing site name")
  
      endpoint = yass.config.get("hosting.%s" % target)
      if not endpoint:
          raise ValueError("%s endpoint is missing in the config" % target.upper())
  
      if target == "s3":
          p = publisher.S3Website(sitename=sitename,
                                  aws_access_key_id=endpoint.get("aws_access_key_id"),
                                  aws_secret_access_key=endpoint.get("aws_secret_access_key"),
                                  region=endpoint.get("aws_region"))
  
          if not p.website_exists:
              print(">>>")
              print("Setting S3 site...")
              if p.create_website() is True:
                  # Need to give it enough time to create it
                  # Should be a one time thing
                  time.sleep(10)
                  p.create_www_website()
                  print("New bucket created: %s" % p.sitename)
  
          if rebuild_manifest:
              print(">>>")
              print("Rebuilding site's manifest...")
              p.create_manifest_from_s3_files()
  
          if purge_files is True or endpoint.get("purge_files") is True:
              print(">>>")
              print("Purging files...")
              exclude_files = endpoint.get("purge_exclude_files", [])
              p.purge_files(exclude_files=exclude_files)
  
          if not skip_upload:
              print(">>>")
              print("Uploading your site...")
              p.upload(yass.build_dir)
          else:
              print(">>>")
              print("WARNING: files upload was skipped because of the use of --skip-upload")
  
          print("")
          print("Yass! Your site has been successfully published to: ")
          print(p.website_endpoint_url)
  
      footer()
docs: Publish the site