The code and data behind xeiaso.net
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

push to Tigris

Signed-off-by: Xe Iaso <me@xeiaso.net>

Xe Iaso e3b77228 dc020774

+67 -32
+63
.github/workflows/tigris-push.yml
··· 1 + name: Build and deploy site to Tigris 2 + 3 + on: 4 + push: 5 + branches: [ "main" ] 6 + 7 + jobs: 8 + deploy: 9 + runs-on: ubuntu-24.04 10 + steps: 11 + - uses: actions/checkout@v4 12 + 13 + - name: Set up Homebrew 14 + uses: Homebrew/actions/setup-homebrew@master 15 + 16 + - name: Setup Homebrew cellar cache 17 + uses: actions/cache@v4 18 + with: 19 + path: | 20 + ~/.linuxbrew/Cellar 21 + key: ${{ runner.os }}-homebrew-cellar-${{ hashFiles('Brewfile.lock.json') }} 22 + restore-keys: | 23 + ${{ runner.os }}-homebrew-cellar- 24 + 25 + - name: Install Brew dependencies 26 + run: | 27 + brew bundle 28 + 29 + - name: Setup Golang caches 30 + uses: actions/cache@v4 31 + with: 32 + path: | 33 + ~/.cache/go-build 34 + ~/go/pkg/mod 35 + key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }} 36 + restore-keys: | 37 + ${{ runner.os }}-golang- 38 + 39 + - name: cache deno.land dependencies 40 + uses: actions/cache@v2 41 + with: 42 + key: ${{ runner.os }}-deno-${{ hashFiles('**/*') }} 43 + restore-keys: ${{ runner.os }}-deno- 44 + path: | 45 + /home/runner/.cache/deno 46 + 47 + - name: Tailscale 48 + uses: tailscale/github-action@v2 49 + with: 50 + oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} 51 + oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} 52 + tags: tag:ci 53 + 54 + - name: Build and deploy xesite 55 + run: | 56 + go run ./cmd/fabricate-generation 57 + env: 58 + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 59 + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 60 + AWS_ENDPOINT_URL_S3: "https://fly.storage.tigris.dev" 61 + AWS_REGION: auto 62 + MIMI_ANNOUNCE_URL: ${{ secrets.MIMI_ANNOUNCE_URL }} 63 +
+4 -32
cmd/fabricate-generation/main.go
··· 21 21 "golang.org/x/oauth2" 22 22 "gopkg.in/mxpv/patreon-go.v1" 23 23 "within.website/x/tigris" 24 - "within.website/x/web" 25 24 "xeiaso.net/v4/internal" 26 25 "xeiaso.net/v4/internal/lume" 27 26 "xeiaso.net/v4/internal/saasproxytoken" 28 27 ) 29 28 30 29 var ( 31 - bucketName = flag.String("bucket-name", "xesite-dev", "Name of the S3 bucket to upload to") 30 + bucketName = flag.String("bucket-name", "xesite", "Name of the S3 bucket to upload to") 32 31 githubSHA = flag.String("github-sha", "", "GitHub SHA to use for the site") 33 32 miURL = flag.String("mimi-announce-url", "", "Mi url (named mimi-announce-url for historical reasons)") 34 33 patreonSaasProxyURL = flag.String("patreon-saasproxy-url", "http://xesite-patreon-saasproxy.flycast", "URL to use for the patreon saasproxy") ··· 58 57 Branch: "main", 59 58 Repo: "https://github.com/Xe/site", 60 59 StaticSiteDir: "lume", 61 - URL: "https://xeiaso.net", 60 + URL: *siteURL, 62 61 Development: false, 63 62 PatreonClient: pc, 64 63 DataDir: "./var", ··· 75 74 } 76 75 } 77 76 78 - func uploadSlug(cli *http.Client, host, fname string) error { 79 - fin, err := os.Open(fname) 80 - if err != nil { 81 - return err 82 - } 83 - defer fin.Close() 84 - 85 - req, err := http.NewRequest("PUT", "http://"+host+"/xesite/upload", fin) 86 - if err != nil { 87 - return err 88 - } 89 - 90 - slog.Info("uploading", "host", host) 91 - 92 - resp, err := cli.Do(req) 93 - if err != nil { 94 - return err 95 - } 96 - 97 - if resp.StatusCode != http.StatusOK { 98 - return web.NewError(http.StatusOK, resp) 99 - } 100 - 101 - slog.Info("done", "host", host) 102 - 103 - return nil 104 - } 105 - 106 77 func NewPatreonClient(hc *http.Client) (*patreon.Client, error) { 107 78 ts := saasproxytoken.RemoteTokenSource(*patreonSaasProxyURL, hc) 108 79 tc := oauth2.NewClient(context.Background(), ts) ··· 140 111 ext := filepath.Ext(path) 141 112 mimeType := mime.TypeByExtension(ext) 142 113 if mimeType == "" { 143 - mimeType = "application/octet-stream" // Default MIME type if unknown 114 + // otherwise, detect by content 115 + mimeType = http.DetectContentType(fileContent) 144 116 } 145 117 146 118 key := strings.TrimPrefix(path, cleanFolderPath)