Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Publishes the website in site/ to GitHub Pages. It runs only when a push to
# main changes something under site/ (or this file), and can be run by hand
# from the Actions tab. The site is plain files: nothing is built.
# Publishes the website in site/ to GitHub Pages. It runs when a push to main
# changes something under site/ (or this file), when a release is complete
# (release.yml starts it), and by hand from the Actions tab. The site is plain
# files: nothing is built, but the newest release's version is written in.
#
# Pages must be set to deploy from GitHub Actions: Settings › Pages › Source.
name: pages
Expand Down Expand Up @@ -32,6 +33,23 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
# The pages name the newest release, and link straight to its files,
# before the visitor's browser asks GitHub. The release workflow runs
# this deploy again once a release is complete, so they never lag.
- name: Name the newest release
env:
GH_TOKEN: ${{ github.token }}
run: |
v=$(gh release view --repo "$GITHUB_REPOSITORY" --json tagName -q .tagName | sed 's/^v//')
if ! echo "$v" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Latest release '$v' is not a version; the pages keep what they have."
exit 0
fi
sed -i -E "s/const KNOWN = '[^']*'/const KNOWN = '$v'/" site/assets/site.js
sed -i -E "s/\"softwareVersion\":\"[^\"]*\"/\"softwareVersion\":\"$v\"/" site/index.html
sed -i -E "s#releases/download/v[0-9.]+/Filiation-Setup-[0-9.]+-windows-amd64\.exe#releases/download/v$v/Filiation-Setup-$v-windows-amd64.exe#g" site/index.html site/docs/install/index.html
grep -q "const KNOWN = '$v'" site/assets/site.js
echo "The pages name v$v."
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,16 @@ jobs:
$lines += "$hash $name"
[IO.File]::WriteAllText("$PWD/sums/checksums.txt", ($lines -join "`n") + "`n")
gh release upload $tag sums/checksums.txt --clobber

# The website names the newest release and links to its installer; publish
# it again now the release is complete (pages.yml).
website:
needs: windows-installer
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Deploy the website
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run pages.yml --repo "$GITHUB_REPOSITORY" --ref main
2 changes: 1 addition & 1 deletion site/assets/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
const cmds = $$('code[data-cmd]');
cmds.forEach((c) => { c.dataset.template = c.textContent; });
const fill = (v) => cmds.forEach((c) => { c.textContent = c.dataset.template.replace(/\{v\}/g, v); });
fill(window.filVersion || '0.4.2');
fill(window.filVersion);
document.addEventListener('fil:version', (e) => {
fill(e.detail);
const os = $('[data-tabgroup="os"] [aria-selected="true"]');
Expand Down
2 changes: 1 addition & 1 deletion site/assets/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
const showOS = (os) => {
osNow = os;
select(osTabs, osTabs.find((b) => b.dataset.os === os));
$('#os-cmd').textContent = cmds[os](window.filVersion || '0.4.1');
$('#os-cmd').textContent = cmds[os](window.filVersion);
const dl = $('#os-download');
dl.dataset.os = os;
dl.textContent = 'Download fil for ' + { windows: 'Windows', macos: 'macOS', linux: 'Linux' }[os];
Expand Down
23 changes: 20 additions & 3 deletions site/assets/site.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Shared by both pages: copy buttons, the phone menu, the star count, and
// download links that point at the newest release for the visitor's system.
// Every piece works without the network: links fall back to the releases page.
// Every piece works without the network: links name the newest release the
// page knows of.
(() => {
const REPO = 'codevector-2003/filiation';
const RELEASES = 'https://github.com/' + REPO + '/releases/latest';
Expand Down Expand Up @@ -70,8 +71,24 @@

// Download links: [data-download="app|cli"], optionally with
// data-os="windows|macos|linux" to pin a system instead of the visitor's.
const fallback = () => document.querySelectorAll('[data-download]').forEach((a) => { a.href = RELEASES; });
fallback();
// They point straight at the files of the newest release known when the
// page was published, which the deploy writes in below (pages.yml), so
// they are right before GitHub answers, and when it never does (it allows
// 60 requests an hour from one address). GitHub's answer then replaces
// them with a newer release's, if there is one.
const KNOWN = '0.4.4';
const fileURL = (v, name) => 'https://github.com/' + REPO + '/releases/download/v' + v + '/' + name;
const known = {
cli: { windows: 'fil_' + KNOWN + '_windows_amd64.zip', macos: 'fil_' + KNOWN + '_darwin_arm64.tar.gz', linux: 'fil_' + KNOWN + '_linux_amd64.tar.gz' },
Comment thread
codevector-2003 marked this conversation as resolved.
Resolved
app: { windows: 'Filiation-Setup-' + KNOWN + '-windows-amd64.exe' },
};
const urls = (set) => Object.fromEntries(Object.entries(set).map(([k, name]) => [k, fileURL(KNOWN, name)]));
window.filAssets = { cli: urls(known.cli), app: urls(known.app) };
document.querySelectorAll('[data-download]').forEach((a) => {
a.href = window.filAssets[a.dataset.download][a.dataset.os || os] || RELEASES;
});
window.filVersion = KNOWN;
document.querySelectorAll('[data-version]').forEach((el) => { el.textContent = el.dataset.version.replace('{v}', KNOWN); });
get('https://api.github.com/repos/' + REPO + '/releases/latest').then((rel) => {
const version = String(rel.tag_name || '').replace(/^v/, '');
const assets = rel.assets || [];
Expand Down
2 changes: 1 addition & 1 deletion site/docs/install/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ <h1 class="serif">Install</h1>
<h2 class="serif" id="install-app">The app</h2>
<div data-panel="os:windows">
<p>Download the installer and run it. It installs for you only, needs no administrator rights, and adds fil to your PATH so a terminal and your AI assistant can find it.</p>
<p><a class="btn primary" href="https://github.com/codevector-2003/filiation/releases/latest" data-download="app" data-os="windows">Download the Windows installer</a></p>
<p><a class="btn primary" href="https://github.com/codevector-2003/filiation/releases/download/v0.4.4/Filiation-Setup-0.4.4-windows-amd64.exe" data-download="app" data-os="windows">Download the Windows installer</a></p>
<div class="note warn"><span class="ico">!</span><span>The installer isn't signed yet, so Windows SmartScreen may warn you. Choose <b>More info</b>, then <b>Run anyway</b>.</span></div>
</div>
<div data-panel="os:macos" hidden><p>A macOS installer is coming. Until then, the app builds from source (see <a href="https://github.com/codevector-2003/filiation/blob/main/CONTRIBUTING.md">CONTRIBUTING.md</a>), and the command line below works today.</p></div>
Expand Down
4 changes: 2 additions & 2 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<script>try{var t=localStorage.getItem('fil-theme');if(t==='light'||t==='dark')document.documentElement.dataset.theme=t;}catch(e){}</script>
<link rel="stylesheet" href="assets/site.css">
<link rel="stylesheet" href="assets/home.css">
<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"SoftwareApplication","name":"Filiation","url":"https://codevector-2003.github.io/filiation/","description":"A citation graph and research library you run on your own computer: give it one paper and it follows the references, keeps the open-access PDFs, searches them to the page, and serves the library to AI assistants over MCP.","applicationCategory":"ReferenceApplication","operatingSystem":"Windows, macOS, Linux","softwareVersion":"0.4.2","license":"https://www.apache.org/licenses/LICENSE-2.0","image":"https://codevector-2003.github.io/filiation/assets/img/og.jpg","screenshot":"https://codevector-2003.github.io/filiation/assets/img/papers.webp","downloadUrl":"https://github.com/codevector-2003/filiation/releases/latest","codeRepository":"https://github.com/codevector-2003/filiation","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}},{"@type":"WebSite","name":"Filiation","url":"https://codevector-2003.github.io/filiation/"}]}</script>
<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"SoftwareApplication","name":"Filiation","url":"https://codevector-2003.github.io/filiation/","description":"A citation graph and research library you run on your own computer: give it one paper and it follows the references, keeps the open-access PDFs, searches them to the page, and serves the library to AI assistants over MCP.","applicationCategory":"ReferenceApplication","operatingSystem":"Windows, macOS, Linux","softwareVersion":"0.4.4","license":"https://www.apache.org/licenses/LICENSE-2.0","image":"https://codevector-2003.github.io/filiation/assets/img/og.jpg","screenshot":"https://codevector-2003.github.io/filiation/assets/img/papers.webp","downloadUrl":"https://github.com/codevector-2003/filiation/releases/latest","codeRepository":"https://github.com/codevector-2003/filiation","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}},{"@type":"WebSite","name":"Filiation","url":"https://codevector-2003.github.io/filiation/"}]}</script>
</head>
<body>
<a class="skip" href="#main">Skip to the content</a>
Expand Down Expand Up @@ -280,7 +280,7 @@ <h2 class="h2 serif">Filiation: which text was copied from which.</h2>
<span class="p">For everyone. Your papers, search, the map and the Reader in one window.</span>
<div class="row"><span class="tile plain">Windows installer</span><span class="tile plain">Updates itself</span></div>
<span class="fine">macOS and Linux: installers are coming; the app builds from source today.</span>
<a class="btn primary push" href="https://github.com/codevector-2003/filiation/releases/latest" data-download="app" data-os="windows">Download for Windows</a>
<a class="btn primary push" href="https://github.com/codevector-2003/filiation/releases/download/v0.4.4/Filiation-Setup-0.4.4-windows-amd64.exe" data-download="app" data-os="windows">Download for Windows</a>
</div>
<div class="card start">
<b class="ct big">The command line</b>
Expand Down
2 changes: 1 addition & 1 deletion site/tools/docs/install.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<h2 class="serif" id="install-app">The app</h2>
<div data-panel="os:windows">
<p>Download the installer and run it. It installs for you only, needs no administrator rights, and adds fil to your PATH so a terminal and your AI assistant can find it.</p>
<p><a class="btn primary" href="https://github.com/codevector-2003/filiation/releases/latest" data-download="app" data-os="windows">Download the Windows installer</a></p>
<p><a class="btn primary" href="https://github.com/codevector-2003/filiation/releases/download/v0.4.4/Filiation-Setup-0.4.4-windows-amd64.exe" data-download="app" data-os="windows">Download the Windows installer</a></p>
<div class="note warn"><span class="ico">!</span><span>The installer isn't signed yet, so Windows SmartScreen may warn you. Choose <b>More info</b>, then <b>Run anyway</b>.</span></div>
</div>
<div data-panel="os:macos" hidden><p>A macOS installer is coming. Until then, the app builds from source (see <a href="https://github.com/codevector-2003/filiation/blob/main/CONTRIBUTING.md">CONTRIBUTING.md</a>), and the command line below works today.</p></div>
Expand Down
Loading