Skip to content

Latest commit

 

History

History
110 lines (80 loc) · 3.69 KB

README.md

File metadata and controls

110 lines (80 loc) · 3.69 KB

@ubiquity-os/action-deploy-plugin

Update Manifest, build and commit the changes signing the commit payload.

Description

This GitHub Action automates the process of checking out a repository, setting up Node.js, installing dependencies, updating the manifest.json file, formatting it, and committing/pushing the changes with a signed commit.

Inputs

  • manifestPath:

    • Description: The path to the manifest.json file.
    • Required: No
    • Default: ${{ github.workspace }}/manifest.json
  • schemaPath:

    • Description: The path to the plugin settings schema.
    • Required: No
    • Default: ${{ github.workspace }}/src/types/plugin-input.js
  • pluginEntry:

    • Description: The path to the plugin entry file.
    • Required: No
    • Default: ${{ github.workspace }}/src/index.ts
  • commitMessage:

    • Description: The commit message.
    • Required: No
    • Default: chore: updated manifest.json and dist build
  • nodeVersion:

    • Description: The version of Node.js to use.
    • Default: 20.10.0

Steps

  1. Check out the repository: Uses the actions/checkout@v4 action to check out the repository.

  2. Set up Node.js: Uses the actions/setup-node@v4 action to set up a specified version of Node.js.

  3. Install dependencies: Runs yarn install to install the project's dependencies with immutable and cache check settings.

  4. Compile TypeScript files: Compiles the TypeScript files using yarn tsc with the specified project configuration.

  5. Build project: Adds the @vercel/ncc package and builds the project using ncc.

  6. Update manifest configuration JSON: Updates the manifest.json file with the plugin settings schema.

  7. Format manifest using Prettier: Installs Prettier and formats the manifest.json file and other project files.

  8. Commit and Push changes: Configures Git, adds the updated files to the commit, and pushes the changes to the repository.

Usage Example

name: Update Manifest and Commit Changes

on:
  push:

jobs:
  update-manifest:
    runs-on: ubuntu-latest
    steps:
      - name: Update Manifest and Commit Changes
        uses: ubiquity-os/action-deploy-plugin@main
        with:
          manifestPath: ${{ github.workspace }}/manifest.json
          schemaPath: ${{ github.workspace }}/src/types/plugin-input.js
          pluginEntry: ${{ github.workspace }}/src/index.ts
          commitMessage: "chore: updated manifest.json and dist build"
          nodeVersion: "20.10.0"
        env:
          APP_ID: ${{ secrets.APP_ID }}
          APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
          APP_INSTALLATION_ID: ${{ secrets.APP_INSTALLATION_ID }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Environment Variables

Required

  • GITHUB_TOKEN: A GitHub token with repository permissions. This is automatically provided by GitHub Actions and does not require manual setup.

Optional

If GitHub App authentication is to be used, the following environment variables are needed:

  • APP_ID: The GitHub App ID.
  • APP_PRIVATE_KEY: The GitHub App private key.
  • APP_INSTALLATION_ID: The installation ID for the GitHub App.

When APP_ID and APP_PRIVATE_KEY are provided, the action will use GitHub App authentication. If they are not provided, the action will default to using GITHUB_TOKEN.

Features

  • Clones the repository and sets up Node.js.
  • Installs project dependencies and compiles TypeScript files.
  • Builds the project using @vercel/ncc.
  • Updates the manifest.json file.
  • Formats the project files using Prettier.
  • Commits and pushes changes to the repository.