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
51 changes: 51 additions & 0 deletions .github/workflows-archive/a-b-build-only.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build Docusaurus Site (Manual)

on:
workflow_dispatch:
inputs:
target:
description: "Build target (affects baseUrl config)"
required: true
default: "dreamhost"
type: choice
options:
- dreamhost
- gh

permissions:
contents: read

jobs:
build:
name: Build site
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20
cache: npm
cache-dependency-path: website/package-lock.json

- name: Install dependencies
run: |
cd website
npm ci

- name: Build Docusaurus site
env:
DEPLOY_TARGET: ${{ inputs.target }}
run: |
cd website
npm run build

- name: Upload build artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: docusaurus-build
path: website/build
# JMH -- TBD:
# retention-days: 7
125 changes: 125 additions & 0 deletions .github/workflows-archive/a-b-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Build & Deploy Docusaurus Site

on:
push:
branches: [ main ]

pull_request:
branches: [ main ]

workflow_dispatch:
inputs:
target:
description: "Deploy target"
required: true
default: "gh"
type: choice
options:
- gh
- dreamhost

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
name: Build site
runs-on: ubuntu-latest

outputs:
deploy_target: ${{ steps.set-target.outputs.target }}

steps:
- name: Checkout repo
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Set deploy target
id: set-target
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "target=${{ inputs.target }}" >> $GITHUB_OUTPUT
else
echo "target=gh" >> $GITHUB_OUTPUT
fi

- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20
cache: npm
cache-dependency-path: website/package-lock.json

- name: Install dependencies
run: |
cd website
npm ci

- name: Build Docusaurus site
env:
DEPLOY_TARGET: ${{ steps.set-target.outputs.target }}
run: |
cd website
npm run build

- name: Upload build artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: docusaurus-build
path: website/build


deploy-gh-pages:
name: Deploy to GitHub Pages
needs: build
if: |
needs.build.outputs.deploy_target == 'gh' &&
github.event_name != 'pull_request'
runs-on: ubuntu-latest

environment:
name: github-pages

steps:
- name: Download build artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: docusaurus-build
path: build

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
with:
path: build

- name: Deploy to GitHub Pages
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e #v4.0.5


deploy-dreamhost:
name: Deploy to DreamHost
needs: build
if: |
needs.build.outputs.deploy_target == 'dreamhost' &&
github.event_name != 'pull_request'
runs-on: ubuntu-latest

steps:
- name: Download build artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: docusaurus-build
path: build

- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DREAMHOST_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.DREAMHOST_HOST }} >> ~/.ssh/known_hosts

- name: Deploy via rsync
run: |
rsync -avz --delete build/ \
${{ secrets.DREAMHOST_USER }}@${{ secrets.DREAMHOST_HOST }}:${{ secrets.DREAMHOST_PATH }}/
56 changes: 0 additions & 56 deletions .github/workflows-archive/deploy.yml

This file was deleted.

123 changes: 123 additions & 0 deletions .github/workflows-archive/update-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Update Releases Feed

on:
workflow_dispatch:
schedule:
# - cron: "15 * * * *" # every hour at :15
- cron: "15 9 * * *" # every day at 09:15 UTC

jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: write # needed to commit updates to releases.json

strategy:
max-parallel: 1
matrix:
repo:
- aboutcode-org/aboutcode-toolkit
- aboutcode-org/ai-gen-code-search
- aboutcode-org/binary-inspector
- aboutcode-org/commoncode
- aboutcode-org/container-inspector
- aboutcode-org/debian-inspector
- aboutcode-org/dejacode
- aboutcode-org/dependency-inspector
- aboutcode-org/elf-inspector
- aboutcode-org/extractcode
- aboutcode-org/federatedcode
- aboutcode-org/fetchcode
- aboutcode-org/go-inspector
- aboutcode-org/license-expression
- aboutcode-org/matchcode-toolkit
- aboutcode-org/nuget-inspector
- aboutcode-org/plugincode
- aboutcode-org/purldb
- aboutcode-org/purl-validator
- aboutcode-org/purlvalidator-go
- aboutcode-org/pygmars
- aboutcode-org/python-inspector
- aboutcode-org/rust-inspector
- aboutcode-org/saneyaml
- aboutcode-org/scancode.io
- aboutcode-org/scancode-plugins
- aboutcode-org/scancode-toolkit
- aboutcode-org/scancode-workbench
- aboutcode-org/source-inspector
- aboutcode-org/typecode
- aboutcode-org/univers
- aboutcode-org/vulnerablecode
- aboutcode-org/www.aboutcode.org
# Add more repos here

env:
GITHUB_TOKEN: ${{ secrets.GH_REPO_POLLING }}

steps:
# 1 Checkout the target repo (Repo B)
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: main
fetch-depth: 0
token: ${{ secrets.GH_REPO_POLLING }}

# 2 Debug: show which repo is being processed
- name: Debug - current repo
run: echo "Processing ${{ matrix.repo }}"

# 3 Fetch the latest release from the current source repo
- name: Fetch latest release
run: |
REPO=${{ matrix.repo }}
curl -s -H "Accept: application/vnd.github+json" \
https://api.github.com/repos/$REPO/releases/latest \
-o release.json || echo '{}' > release.json

# 4 Update releases.json in website/static cl
- name: Update releases.json
env:
REPO: ${{ matrix.repo }}
run: |
TMP=$(mktemp)
FILTER=$(mktemp --suffix=.jq)
mkdir -p website/static
if [ ! -f website/static/releases.json ]; then
echo "[]" > website/static/releases.json
fi
printf '%s\n' \
'$existing[0] +' \
'[ $release[0] | {' \
' repo: (if .name==null then "" else .name end),' \
' repo_slug: env.REPO,' \
' repo_url: ("https://github.com/" + env.REPO),' \
' tag: (if .tag_name==null then "" else .tag_name end),' \
' tag_url: (if .html_url==null then "" else .html_url end),' \
' published_at: (if .published_at==null then "" else .published_at end),' \
' releases_page_url: ("https://github.com/" + env.REPO + "/releases"),' \
' compare_url: ("https://github.com/" + env.REPO + "/compare/" + (if .tag_name==null then "" else .tag_name end) + "...main"),' \
' commits_since: 0,' \
' prerelease: .prerelease,' \
' author: (if .author==null then "" else .author.login end)' \
'}' \
'] | sort_by(.published_at) | reverse | unique_by(.repo_url) | sort_by(.published_at) | reverse' \
> "$FILTER"
jq -n \
--slurpfile existing website/static/releases.json \
--slurpfile release release.json \
-f "$FILTER" > "$TMP"
mv "$TMP" website/static/releases.json
rm -f release.json "$FILTER"
shell: bash

# 5 Commit & push changes if releases.json changed
- name: Commit and push if changed
run: |
git config user.name "AboutCode Automation"
git config user.email "automation@aboutcode.org"
git add website/static/releases.json
git commit -m "$(echo -e "Update releases for ${{ matrix.repo }}\n\nSigned-off-by: AboutCode Automation <automation@aboutcode.org>")" || exit 0
git pull --rebase origin main
git push
shell: bash
Loading