Skip to content

Rewrite with Astro. #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 3 additions & 11 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,8 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Deno environment
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- name: Build site
run: |
deno task build
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: Install & build with Astro
uses: withastro/action@v3

- name: Deploy to CF Pages
id: deploy-preview
Expand All @@ -45,7 +37,7 @@ jobs:
with:
apiToken: ${{ env.API_TOKEN }}
accountId: ${{ env.ACCOUNT_ID }}
command: pages deploy target --project-name=${{ github.event.repository.name }} --branch=${{ env.BRANCH_NAME }}
command: pages deploy dist --project-name=${{ github.event.repository.name }} --branch=${{ env.BRANCH_NAME }}

- name: Report preview environment in PR
uses: actions/github-script@v7
Expand Down
33 changes: 14 additions & 19 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Publish on GitHub Pages
run-name: "Publish GH Pages: '${{ github.event.head_commit.message }}'"

# From https://docs.astro.build/en/guides/deploy/github/

on:
workflow_dispatch: # Enable manual runs.
push:
branches: ["master"]

Expand All @@ -10,7 +14,7 @@ permissions:
id-token: write

jobs:
deploy:
build:
runs-on: ubuntu-latest

environment:
Expand All @@ -21,25 +25,16 @@ jobs:
- name: Clone repository
uses: actions/checkout@v4

- name: Setup Deno environment
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- name: Build site
run: |
deno task build
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "target"
- name: Install & build with Astro
uses: withastro/action@v3

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
26 changes: 26 additions & 0 deletions .github/workflows/update-probe-rs-dep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Update probe-rs dep
run-name: "Update probe-rs dep: '${{ github.event.client_payload.event.head_commit.message }}'"

on:
workflow_dispatch:
repository_dispatch:
types: [update_probe_rs_dep]

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
- uses: actions/setup-node@v4
with:
node-version: 23
- run: npm update probe.rs-data
- run: npm run build
- name: git commit
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -am "Update probe-rs dep: '${{ github.event.client_payload.event.head_commit.message }}'"
git push
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
/target
/dist
/_cache
.DS_Store
/probe-rs-repo
/probe-rs-repo

# Node dependencies
node_modules/

# Astro's generated types
.astro/

# Cloudflare CLI
.wrangler
4 changes: 4 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode", "unifiedjs.vscode-mdx"],
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
93 changes: 78 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The new probe.rs webpage
# The new (new) probe.rs webpage

## Goals

Expand All @@ -15,37 +15,100 @@
- Can we also add hints in our error messages
- Clean up docs a lot and explain in more detail.
- Add a searchable list of provided targets with information about each target.
- Avoid maintenance issues of Deno & Lume.

## Development

[Install](https://deno.land/[email protected]/getting_started/installation) deno
[Install](https://deno.land/[email protected]/getting_started/installation) NodeJS
which is the JS runtime to generate all webpage docs.

Alternatively, use [Nix](https://nixos.org/download/) to fetch the
development shell tools:

```sh
nix-shell
```

Fetch dependencies. Be patient, it may take a while on the first run.

```sh
npm install
```

Then locally serve the documentation from the root of this repository. Be
patient, it may take a while on the first run.

```
$ deno task serve
```sh
npm run dev
```

When the documentation preview is ready and gets served, you will be greeted
with something like:

```
🍾 Site built into ./target
129 files generated in 62.64 seconds
> [email protected] dev
> astro dev

astro v5.5.2 ready in 1355 ms

┃ Local http://localhost:4322/probe.rs-astro
┃ Network use --host to expose

10:04:56 watching for file changes...
```

## Building & Testing Static Site

To build the site, into the `dist/` folder:

```sh
npm run build
```

Server started at:
http://localhost:3000/ (local)
http://192.0.2.3:3000/ (network)
And start a local static server with the contents of `dist/`,
served at your configured base path:

```sh
npm run preview
```

When doing heavy development, you might end in the need to provide a GitHub API
Token (for fetching the probe-rs repository in the background). See
[here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
for how to get yours, save it to a file like `~/.probe-rs-github-token` and
provide it to deno via the environment variable `GITHUB_TOKEN` as follows:
And visit it, _with_ your base path if set:

http://localhost:3000/probe.rs-astro/

## Targets & Manufacturers Data Dependency

This repo currently pulls in targets & manufacturer data from https://github.com/julianguide/probe.rs-data using
NPM:

```sh
npm install https://github.com/julianguide/probe.rs-data
```
$ export GITHUB_TOKEN=$(cat ~/.probe-rs-github-token)

The dependency gets updated automatically by .github/workflows/update-probe-rs-dep.yml,
or can be updated manually with:

```sh
npm update probe.rs-data
```

## Changing URL

If changing the serving domain or path, update `site` and `base` in astro.config.mjs.

## Icons

Find free / open source icons (https://iconify.design/),
throw them in `src/icons`, and use an `<Icon />` tag:

```html
<Icon name="carbon--table-of-contents" class="text-green" />
```

## Original Template

This website is a customzied version of Astro's blog template:

```sh
npm create astro@latest -- --template blog
```
114 changes: 0 additions & 114 deletions _config.ts

This file was deleted.

Loading
Loading