Skip to content

Commit

Permalink
Update README and URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
jstayton committed Nov 29, 2023
1 parent 88defe7 commit 580eb49
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 38 deletions.
88 changes: 59 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,52 @@
# Suri × Deploy to GitHub Pages
<h1 align="center" width="100%">
<img src="https://raw.githubusercontent.com/jstayton/suri/v1/logo.png" width="200" alt="Suri" />
</h1>

<h3 align="center" width="100%">
<i>Your own shortlinks as an easily deployed static site on GitHub Pages</i>
</h3>

You're viewing a template repository tailored for deploying Suri to
[GitHub Pages](https://pages.github.com/) with
[GitHub Actions](https://docs.github.com/en/actions).

What's Suri? Suri is your own link shortener that's easily deployed as a static
site. No server-side hosting, serverless cloud functions, or database necessary.
Head over to the main [`jstayton/suri`](https://github.com/jstayton/suri)
repository to learn more, including additional deployment methods.
[GitHub Actions](https://docs.github.com/en/actions). Head over to
[the main repository](https://github.com/surishortlink/suri) to learn more about
Suri, including additional deployment options.

## Setup
## Setup: Step By Step

1. Click the "Use this template" button above and then "Create a new
repository". Fill in the required details to create a new repository based on
this one.
1. Hit the "Use this template" button above and then "Create a new repository".
Fill in the required details to create a new repository based on this one.
2. Go to the "Settings" of your new repository and head to the "Pages" section.
Under "Build and deployment", change the "Source" to "GitHub Actions".
3. Go to the "Actions" of your new repository. There should be a workflow run
that likely failed because the previous step wasn't yet completed. Go ahead
and click into the workflow run and click the "Re-run jobs" button.
4. Any commits to the `main` branch of your new repository will trigger a new
deploy. You can change this by editing
[`.github/workflows/deploy.yml`](./.github/workflows/deploy.yml), which is
the GitHub Actions workflow for building the site and deploying to GitHub
Pages.
5. If you want to use a custom domain, follow GitHub's guide:
[Managing a custom domain for your GitHub Pages site](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site).
and view the workflow run and hit the "Re-run jobs" button.

### Auto-Deploy

Any commits to the `main` branch of your new repository will trigger a new build
and deploy. You can change this by editing
[`.github/workflows/deploy.yml`](.github/workflows/deploy.yml), which is the
GitHub Actions workflow for building the site and deploying to GitHub Pages.

### Custom Domain

To use a custom domain, follow GitHub's guide:
[Managing a custom domain for your GitHub Pages site](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site).

## How It Works

## Manage Links
### Manage Links

Links are managed through [`./src/links.json`](./src/links.json), which is
seeded with a few examples to start:
At the heart of Suri is the [`links.json`](src/links.json) file, located in the
`src` directory, where you manage your links. All of the template repositories
include this file seeded with a few examples:

```json
{
"/": "https://github.com/jstayton/suri",
"/": "https://www.youtube.com/watch?v=CsHiG-43Fzg",
"1": "https://fee.org/articles/the-use-of-knowledge-in-society/",
"tw": "https://twitter.com"
"gh": "https://github.com/surishortlink/suri"
}
```

Expand All @@ -45,14 +55,34 @@ and the value is the target URL. Keys can be as short or as long as you want,
using whatever mixture of characters you want. `/` is a special entry for
redirecting the root path.

Go ahead and make an edit, then commit and push to your repository. GitHub
Actions should automatically build and deploy your change. That's it!
### Build Static Site

## Config
Suri ships with a `suri` executable file that generates the static site from the
`links.json` file. The static site is output to a directory named `build`.

Config options are set in [`suri.config.json`](suri.config.json). There is only
one at this point:
All of the template repositories are configured with a `build` script that
invokes this executable, making the command you run simple:

```bash
npm run build
```

When you make a change to the `links.json` file, simply re-run this command to
re-generate the static site, which can then be re-deployed. This template
repository is configured to do this automatically.

### Config

Configuration is handled through the [`suri.config.json`](suri.config.json) file
in the root directory. There is only one option at this point:

| Option | Description | Type | Default |
| ------ | ------------------------------------------------------------------ | ------- | ------- |
| `js` | Whether to redirect with JavaScript instead of a `<meta>` refresh. | Boolean | `false` |

### Public Directory

Finally, any files in the `public` directory will be copied over to the `build`
directory without modification when the static site is built. This can be useful
for files like `favicon.ico` or `robots.txt` (that said, Suri provides sensible
defaults for both).
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@suri/deploy-github",
"name": "@surishortlink/deploy-github",
"version": "1.0.0",
"private": true,
"type": "module",
"description": "A template repository tailored for deploying Suri to GitHub Pages",
"homepage": "https://github.com/staticsuri/suri-deploy-github#readme",
"bugs": "https://github.com/staticsuri/suri-deploy-github/issues",
"homepage": "https://github.com/surishortlink/suri-deploy-github#readme",
"bugs": "https://github.com/surishortlink/suri-deploy-github/issues",
"license": "MIT",
"repository": "staticsuri/suri-deploy-github",
"repository": "surishortlink/suri-deploy-github",
"scripts": {
"build": "suri"
},
Expand Down
4 changes: 2 additions & 2 deletions src/links.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/": "https://github.com/jstayton/suri",
"/": "https://www.youtube.com/watch?v=CsHiG-43Fzg",
"1": "https://fee.org/articles/the-use-of-knowledge-in-society/",
"tw": "https://twitter.com"
"gh": "https://github.com/surishortlink/suri"
}

0 comments on commit 580eb49

Please sign in to comment.