Load gitea token from .env.local

This commit is contained in:
Jon Staab 2026-09-17 16:36:31 -07:00
parent 0922a98eb6
commit 4fc3c02ced
2 changed files with 8 additions and 3 deletions

View file

@ -160,11 +160,13 @@ Signed APKs are attached to releases on the
[releases page](https://gitea.coracle.social/coracle/flotilla/releases), so Android users can [releases page](https://gitea.coracle.social/coracle/flotilla/releases), so Android users can
install and update outside an app store. install and update outside an app store.
Bump the version, write its `CHANGELOG.md` section and push the matching tag, then: Publishing needs `GITEA_TOKEN` in `.env.local`, set to a gitea access token with `write:repository`
(Settings → Applications → Access Tokens). Bump the version, write its `CHANGELOG.md` section and
push the matching tag, then:
```sh ```sh
pnpm run release:android pnpm run release:android
GITEA_TOKEN=... pnpm run publish:android pnpm run publish:android
``` ```
`publish:android` creates the release for the tag, takes its notes from the changelog, and attaches `publish:android` creates the release for the tag, takes its notes from the changelog, and attaches

View file

@ -1,8 +1,11 @@
#!/usr/bin/env node #!/usr/bin/env node
import {readFile} from "node:fs/promises" import {readFile} from "node:fs/promises"
import {config} from "dotenv"
const read = path => readFile(new URL(path, import.meta.url), "utf-8") const read = path => readFile(new URL(path, import.meta.url), "utf-8")
config({path: new URL("../.env.local", import.meta.url)})
const token = process.env.GITEA_TOKEN const token = process.env.GITEA_TOKEN
const {name, version} = JSON.parse(await read("../package.json")) const {name, version} = JSON.parse(await read("../package.json"))
const changelog = await read("../CHANGELOG.md") const changelog = await read("../CHANGELOG.md")
@ -44,7 +47,7 @@ const api = async (method, path, {body, allow404} = {}) => {
} }
if (!token) { if (!token) {
throw new Error("Set GITEA_TOKEN to a token with write access to the repository") throw new Error("Set GITEA_TOKEN in .env.local to a token with write access to the repository")
} }
const lines = changelog.split("\n") const lines = changelog.split("\n")