Skip to content
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

Init projects dashboard #5

Merged
merged 18 commits into from
Oct 10, 2024
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
108 changes: 108 additions & 0 deletions .github/workflows/projects-dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Build and deploy projects-dashboard

on:
push:
branches: [main]
paths:
- "projects-dashboard/**"
- ".github/workflows/projects-dashboard.yml"
pull_request:
branches: [main]
paths:
- "projects-dashboard/**"
- ".github/workflows/projects-dashboard.yml"
workflow_dispatch:

# Allow this job to clone the repo and write comments
permissions:
contents: write
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
outputs:
path: ${{ steps.get-target-folder.outputs.path }}
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4

- name: Get target folder
id: get-target-folder
env:
GITHUB_HEAD_REF: ${{ github.head_ref }}
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
if [ "$GITHUB_HEAD_REF" != "" ]; then
# This is a pull request
BRANCH=$GITHUB_HEAD_REF
else
# This is a push to a branch
BRANCH=$GITHUB_REF_NAME
fi

TARGET_PATH=projects-dashboard
if [ "$BRANCH" != "main" ]; then
# sanitize branch name
BRANCH=$(echo "$BRANCH" | sed 's/[^a-zA-Z0-9-]/_/g')
TARGET_PATH=projects-dashboard-preview-$BRANCH
fi
echo "path=$TARGET_PATH" >> $GITHUB_OUTPUT

# replace basepath in astro.config.mjs using $PATH
sed -i "s|ospo/projects-dashboard|ospo/${TARGET_PATH}|g" projects-dashboard/astro.config.mjs
cat projects-dashboard/astro.config.mjs

- name: Prepare preview path
if: github.event_name == 'pull_request'
run: |
npm install -g pnpm

- name: Install, build, and upload your site
uses: withastro/action@v3
with:
path: ./projects-dashboard
node-version: 20
package-manager: pnpm@9

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4

- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: github-pages
path: projects-dashboard-site

- name: Unzip site artifact
run: |
cd ./projects-dashboard-site
tar -xvf artifact.tar .
rm artifact.tar
cd ..
ls -R ./projects-dashboard-site

- name: Deploy to GitHub Pages
id: deployment
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: projects-dashboard-site
target-folder: ${{ needs.build.outputs.path }}

# Add a comment to the PR with the link to the deployed site
- name: Add preview comment to PR
if: github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
comment_tag: preview-deploy
message: |
Site preview deployed to: https://block-open-source.github.io/ospo/${{ needs.build.outputs.path }}

_(execution **[#${{ github.run_id }}](https://github.com/block-open-source/ospo/actions/runs/${{ github.run_id }})** / attempt **${{ github.run_attempt }}**)_
24 changes: 24 additions & 0 deletions projects-dashboard/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store

# jetbrains setting folder
.idea/
4 changes: 4 additions & 0 deletions projects-dashboard/.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 projects-dashboard/.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"
}
]
}
35 changes: 35 additions & 0 deletions projects-dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Block Open Source Projects Dashboard

It's a static generated dashboard to list our maintained open source projects and their health status.

Visit the [live dashboard](https://block-open-source.github.io/ospo/projects-dashboard/).

## Ready to open source your project?

Add your project to the `src/content/projects` directory.

TODO: add description of each field in the config file. For now use one of the existing projects as an example:

- [example-java-kotlin-maven-multimodule](./src/content/project/block-open-source_example-java-kotlin-maven-multimodule.md)
- [tbdex-rs](./src/content/project/TBD54566975_tbdex-rust.md)
- [web5-js](./src/content/project/TBD54566975_web5-js.md)

## Development

Requirements: Node.js 20+ and pnpm

```sh
pnpm i
pnpm dev
```

And to preview the built version that is going to be deployed:

```sh
pnpm build
pnpm preview
```

## Deployment

This project is deployed automatically when a change is merged into the `main` branch.
15 changes: 15 additions & 0 deletions projects-dashboard/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// @ts-check
import { defineConfig } from "astro/config";
import mdx from "@astrojs/mdx";

import sitemap from "@astrojs/sitemap";

// https://astro.build/config
export default defineConfig({
site: "https://block-open-source.github.io",
base: "ospo/projects-dashboard",
integrations: [mdx(), sitemap()],
build: {
assets: "generated-assets",
},
});
20 changes: 20 additions & 0 deletions projects-dashboard/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "former-fusion",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^3.1.7",
"@astrojs/rss": "^4.0.7",
"@astrojs/sitemap": "^3.1.6",
"astro": "^4.15.10",
"@astrojs/check": "^0.9.3",
"typescript": "^5.6.2"
}
}
Loading