Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jstayton committed Nov 13, 2023
0 parents commit 32edec4
Show file tree
Hide file tree
Showing 9 changed files with 171 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
- name: Install npm dependencies
run: npm install
- name: Build
run: npm run build
- name: Fix permissions
run: |
chmod -c -R +rX "build/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: build/
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# npm
/node_modules

# Suri
/build
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MIT License

Copyright (c) 2023 Justin Stayton

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Suri × Deploy to GitHub Pages

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

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.

## Install

_TBD_

## Manage Links

Links are managed through [`./src/links.json`](./src/links.json), which is
seeded with a few examples to start:

```json
{
"/": "https://github.com/jstayton/suri",
"1": "https://fee.org/articles/the-use-of-knowledge-in-society/",
"tw": "https://twitter.com"
}
```

It couldn't be simpler: the key is the "shortlink" path that gets redirected,
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 Pages
should automatically build and deploy your change. That's it!

## Config

Config options are set in [`suri.config.json`](suri.config.json). There is only
one at this point:

| Option | Description | Type | Default |
| ------ | ------------------------------------------------------------------ | ------- | ------- |
| `js` | Whether to redirect with JavaScript instead of a `<meta>` refresh. | Boolean | `false` |
31 changes: 31 additions & 0 deletions package-lock.json

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

20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@suri/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",
"license": "MIT",
"repository": "staticsuri/suri-deploy-github",
"scripts": {
"build": "suri"
},
"devDependencies": {
"suri": "github:jstayton/suri#v1"
},
"engines": {
"node": ">=18"
}
}
5 changes: 5 additions & 0 deletions src/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"/": "https://github.com/jstayton/suri",
"1": "https://fee.org/articles/the-use-of-knowledge-in-society/",
"tw": "https://twitter.com"
}
3 changes: 3 additions & 0 deletions suri.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"js": false
}

0 comments on commit 32edec4

Please sign in to comment.