Skip to content

feat: add extension list and detail pages (#64) #99

feat: add extension list and detail pages (#64)

feat: add extension list and detail pages (#64) #99

Workflow file for this run

# Sample workflow for building and deploying a Web site to GitHub Pages
#
# To get started with Web see: https://nextjs.org/docs/getting-started
#
name: Deploy Web site to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
tags:
- "v*"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
package_json_file: "package.json"
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- name: Update data.json with latest versions and publish dates
run: |
set -e
DATA_JSON_PATH="public/data.json"
echo "Fetching latest version info..."
VERSION_INFO=$(curl -s --fail --max-time 10 https://release.infinilabs.com/.latest)
APP_FULL_VERSION=$(echo "$VERSION_INFO" | jq -r '.["coco-app"]')
SERVER_FULL_VERSION=$(echo "$VERSION_INFO" | jq -r '.["coco-server"]')
echo "App Version: $APP_FULL_VERSION, Server Version: $SERVER_FULL_VERSION"
get_gh_publish_date() {
local repo_slug="$1" # e.g., infinilabs/coco-app
local full_ver_from_latest="$2" # e.g., 0.5.3-2323 (this is the version string from .latest)
local date_val
# Extract X.Y.Z part from the full version string
local xyz_part=$(echo "$full_ver_from_latest" | cut -d'-' -f1) # e.g., 0.5.3
# Construct the X.Y.0 part
local xy_part=$(echo "$xyz_part" | cut -d'.' -f1,2) # e.g., 0.5
local xyz_zero_patch_part="${xy_part}.0" # e.g., 0.5.0
local tag_attempt1="v${xyz_part}" # Primary attempt, e.g., v0.5.3
local tag_attempt2="v${xyz_zero_patch_part}" # Fallback, e.g., v0.5.0
sleep 10
# Attempt 1: X.Y.Z version tag (e.g., v0.5.3)
date_val=$(curl -m60 -s "https://api.github.com/repos/${repo_slug}/releases/tags/${tag_attempt1}" | \
jq -r '.created_at | split("T")[0 // empty]' 2>/dev/null)
sleep 10
# Attempt 2: X.Y.0 version tag (e.g., v0.5.0)
if [[ -z "$date_val" || "$date_val" == "null" ]]; then
date_val=$(curl -m60 -s "https://api.github.com/repos/${repo_slug}/releases/tags/${tag_attempt2}" | \
jq -r '.created_at | split("T")[0 // empty]' 2>/dev/null)
fi
# Final fallback to current date
if [[ -z "$date_val" || "$date_val" == "null" ]]; then
date_val=$(date +%Y-%m-%d)
fi
echo "$date_val"
}
APP_PUBLISH_DATE=$(get_gh_publish_date "infinilabs/coco-app" "$APP_FULL_VERSION")
SERVER_PUBLISH_DATE=$(get_gh_publish_date "infinilabs/coco-server" "$SERVER_FULL_VERSION")
echo "App Publish Date: $APP_PUBLISH_DATE"
echo "Server Publish Date: $SERVER_PUBLISH_DATE"
jq \
--arg app_ver "$APP_FULL_VERSION" \
--arg server_ver "$SERVER_FULL_VERSION" \
--arg app_date "$APP_PUBLISH_DATE" \
--arg server_date "$SERVER_PUBLISH_DATE" \
'.app = $app_ver | .server = $server_ver | .app_publish = $app_date | .server_publish = $server_date' \
"$DATA_JSON_PATH" > tmp_data.json && mv tmp_data.json "$DATA_JSON_PATH"
echo "Updated $DATA_JSON_PATH"
echo
cat "$DATA_JSON_PATH"
- name: Setup Pages
uses: actions/configure-pages@v5
with:
# Automatically inject basePath in your Web configuration file and disable
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
#
# You may remove this line if you want to manage the configuration yourself.
static_site_generator: next
- name: Restore cache
uses: actions/cache@v4
with:
path: |
.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml') }}
- name: Install dependencies
run: pnpm install --registry=https://registry.npmjs.org --quiet
- name: Build with Web
env:
NODE_ENV: production
run: pnpm build
- name: Add CNAME file
run: echo "coco.rs" > ./docs/CNAME
- name: Disable Jekyll
run: touch docs/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4