Ind.ie is now Small Technology Foundation.
Commit eccd915d authored by Aral Balkan's avatar Aral Balkan

Added deploy and save scripts and updated readme with information about them. Closes #5.

parent 65aa7aeb
#!/bin/bash
#
# Deploys content changes to production.
# (Auto-generates tag label and pushes tags to live.)
#
# (Make sure you have commited your changes and saved them to production using the ./save script first.)
#
set -e
dateStamp=$(date "+%Y%m%d")
counterFolderPath="/tmp/better-content"
counterFilePath="${counterFolderPath}/$dateStamp"
#
# Set up the counter, if necessary.
#
mkdir -p "$counterFolderPath"
if ! [ -f "$counterFilePath" ]; then
# Counter does not exist for this day, create it.
echo "Counter does not exist"
echo 0 > "$counterFilePath"
fi
#
# Increment the counter.
#
currentDayDeploymentCount=$(( $(cat "$counterFilePath") + 1 ))
# Persist the counter.
echo "$currentDayDeploymentCount" > "$counterFilePath"
# Format the counter (padded to three spaces).
printf -v formattedCurrentDayDeploymentCount "%03d" $currentDayDeploymentCount
# Create the git tag label
gitTagLabel="${dateStamp}-${formattedCurrentDayDeploymentCount}"
echo "Git tag label: ${gitTagLabel}"
# Create the git tag
git tag -s "$gitTagLabel"
# Push the git tags
git push live --tags
echo "\nDeployment complete.\n\nSee https://www.better.fyi and https://data.better.fyi for changes.\n"
......@@ -30,6 +30,43 @@ Buying Better on the App Store is one way to support us. If you want to help wit
The easiest way to get started is to follow the instructions in the readme for the [Better iOS app](https://source.ind.ie/better/app) repository.
## Testing locally.
[Better Builder](https://source.ind.ie/better/builder) will automatically pick up your changes as you save and rebuild your local data.
To persist your changes locally, commit them in Git and push to origin:
```bash
git commit -am "My awesome content update"
git push origin master
```
Note that these changes will be destroyed if you run the Better Builder installer (or the Better iOS installer, which runs the Better Builder installer as part of its own installation process). To not lose any work, save your changes regularly by pushing to production, as explained below.
## Saving your changes by pushing to production
You can push to production with:
```bash
./save
```
Or, manually run what the save script does, which is:
```bash
git push live master
```
## Deployment
If you have commit rights to the content repository, just run the deployment script:
```bash
./deploy
```
This will create a tag (you will have to enter a tag mesage when prompted, describing the release) and push it to production. Please make sure that you have already committed your changes and pushed them to production either via `git push live master` or by running the `./save` script, which does the same thing.
# Guide to Blockdown
Better content is authored in Blockdown.
......
#!/bin/bash
echo "\nSaving your work to production…\n"
git push live master
echo "\nSaved.\n"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment