Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Publishing a Site

zuccs edited this page Mar 27, 2015 · 11 revisions

With punch publish (or punch p) command, you can publish a site to Amazon S3 or to a remote server using SFTP protocol.

You will need to specify the configurations for the preferred publishing strategy in config.json.

S3 Publishing Strategy

S3 publishing strategy can be used to serve static site using Amazon S3.

A sample configuration for S3 strategy would look like this:

	"publish" : {
		"strategy" : "s3", 
		"options" : {
			"bucket" : "bucketname",
			"region" : "regionname",
			"key" : "key",
			"secret" : "secret",
			"x-amz-acl": "public-read"
		}
	}

You have to specify a S3 bucket to upload the site and credentials of a user (recommended to create a new user), who got privileges to write to the bucket.

Apart from the required options (bucket, key, secret), you can also specify any S3 specific options such as x-amz-acl.

SFTP Publishing Strategy (available as a plugin)

You can use Punch's SFTP publishing plugin to publish your site to any server with SFTP access. Go through plugin's README to learn how to install and use the plugin.

Keep in Mind

  • Punch will generate the site before publishing. If you don't want to generate the site, set the generate option to false in publish configuration.

  • When a site is published, Punch will store the last published time in a hidden file named .last_published in the project's root directory. Next time, when you run punch publish it will only upload the files modified after the last published time. If you want to force upload the full site, just delete the .last_published file.

  • With current publishing strategies, removed files aren't deleted from the remote servers. You will need to delete them manually.

Defining a Custom Publishing Strategy

If you want to follow a different workflow or use some other mechanism to publish your site, you can define your own publishing strategy. Check the section on Defining a Custom Publishing Strategy to learn how to write one.