GitHub - rajbos/actions-marketplace: Host a GitHub Actions Marketplace in your own organization (original) (raw)

Goal: Host a GitHub Actions Marketplace in your own organization, more info here.

This repo will check all repositories in the organization it sits in and write a actions-data.json to a new branch gh-pages.

Steps to get things working

Schedule runs

The scheduled runs are planned at weekdays, at 7 AM.

get-action-data.yml

The get-action-data will iterate all repositories in the same organization (or user) and find the ones that have actions in them by looking for an action.yml file in the root of the repository. The information from the action.yml file will be parsed and stored in a branch named gh-pages. On updating the file, GitHub Pages will be triggered to publish a new version of your website, with the latest data.

Note: This workflow can be triggered manually or will run on a schedule.

All Workflows Overview

This repository uses several GitHub Actions workflows for different purposes:

Core Workflows

1. get-action-data.yml - Action Data Collection

2. sync-to-gh-pages.yml - Static File Management

3. jekyll-gh-pages.yml - GitHub Pages Deployment

Supporting Workflows

4. visual-test.yml - UI Testing

5. get-action-usages.yml - Usage Analytics

6. build-image.yml - Container Build

7. new-issue.yml - Project Management

GitHub Pages

How GitHub Pages Publishing Works

This repository uses GitHub Actions to publish to GitHub Pages, not branch-based publishing. The deployment involves two key workflows working together:

Deployment Method: GitHub Actions

Configuration Required:

  1. Go to SettingsPages in your forked repository
  2. Under "Build and deployment", set Source to: GitHub Actions (not "Deploy from a branch")
  3. This allows the workflows to deploy directly to GitHub Pages using the Actions deployment mechanism

Two-Workflow Deployment Process

1. Content Management: sync-to-gh-pages.yml

This workflow manages the static website files (HTML, CSS, JavaScript) by syncing them from main to gh-pages branch:

Purpose: Keep the gh-pages branch updated with the latest website files

2. Deployment: jekyll-gh-pages.yml

This workflow actually publishes the site to GitHub Pages:

Purpose: Deploy the gh-pages branch content to the live GitHub Pages site

The Complete Flow

Main Branch Changes
    ↓
[sync-to-gh-pages.yml runs]
    ↓
Files copied to gh-pages branch
    ↓
[jekyll-gh-pages.yml triggered]
    ↓
Site deployed to GitHub Pages
    ↓
Live at https://[owner].github.io/actions-marketplace/

Data File Updates (get-action-data.yml)

The action data (JSON file) is updated separately:

Key Files

Cache Busting

The sync-to-gh-pages.yml workflow implements automatic cache busting:

Important Notes

Security

When you fork this repository, you'll need to verify and then trust the automated workflow, before it will start to run. We use the default GITHUB_TOKEN secret to write the data file back to the forked repository. We post the data file with our default user 'Marketplace Updater' that will show up in your git commit history. If you want to override these values, create these secrets and provide values:

Contributions

Please write an issue first, so we can discuss the direction before putting in to much work.

Running locally: data file generation

To run things locally you need to have PowerShell Core installed and to setup these parameters:

$organization="rajbos-actions" $marketplaceRepo="rajbos-actions/actions-marketplace" $GITHUB_TOKEN="gh-xyz123" $username = "Rob Bos" # will be used for commiting the changes $useremail = "your-email@domain.com" # will be used for commiting the changes

Then you can call the updater to check all repositories in your organization:

.\src\updater.ps1 -orgName organization−PATorganization -PAT organizationPATGITHUB_TOKEN -marketplaceRepo marketplaceRepo−userNamemarketplaceRepo -userName marketplaceRepouserNameusername -userEmail $useremail

Running locally: marketplace website testing:

Use a webhosting application to host the index.html file so you can test and debug it. Configure the actions-data-url.txt file to point to a filled json file with the correct structure (generate it once or use https://raw.githubusercontent.com/rajbos-actions/actions-marketplace/gh-pages/actions-data.json).