added deploy button and github action deploy

This commit is contained in:
alyssadev 2023-09-17 06:34:37 +10:00
parent 2a3e092eea
commit 3e159ac82b
4 changed files with 26 additions and 1 deletions

21
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,21 @@
on:
repository_dispatch:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@master
- name: Publish
uses: cloudflare/wrangler-action@1.3.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
secrets: |
AUTH_KEY
env:
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
AUTH_KEY: ${{ secrets.AUTH_KEY }}

View file

@ -3,6 +3,8 @@ linkie
A simple url shortener. Largely adapting [VandyHacks/vhl.ink](https://github.com/VandyHacks/vhl.ink) with the aim of providing a more ptpb-like experience (i.e the fewest keystrokes from a cli possible while still being reasonably secure for private use)
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/alyssadev/linkie)
Deploying
---------

View file

@ -64,7 +64,7 @@ async function get(host,path,auth) {
keys.forEach(element => paths += `${element.name}\n`);
return new Response(paths,{status:200})
}
if (!path) return Response.redirect("https://aly-smith.carrd.co",301)
if (!path) return Response.redirect(REDIR_URL,301)
path = path.toLowerCase()
const dest = await KV.get(path)
if (dest) return Response.redirect(dest, 302)

View file

@ -4,3 +4,5 @@ compatibility_date = "2023-09-14"
kv_namespaces = [
{ binding = "KV", id = "7214e776a3da4ccd9f9fe5b6c3d3f781" }
]
[vars]
REDIR_URL = "https://aly-smith.carrd.co/"