Home

Awesome

chrvadala/github-actions

A collection of common Github Actions, useful to test and publish software.

chrvadala Donate

Actions

nodejs-test-library-action

This composite action allows us to install, build and test a library. Main steps:

Inputs

InputDescription
NODE_VERSIONNode.js version to setup

Outputs

No available outputs

Example

name: Test

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  build:
    strategy:
      matrix:
        os: [ ubuntu-22.04 ]
        node: [ 14, 16, 18 ]
    name: Test Nodejs v${{ matrix.node }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
      - uses: chrvadala/github-actions/nodejs-test-library-action@v1
        with:
          NODE_VERSION: ${{ matrix.node }}

nodejs-release-library-action

This composite action allows us to release a NodeJS library to npm. Main steps:

Inputs

InputDescription
NEXT_VERSIONThe version that we want to release (one of major, minor, patch)
NPM_TOKENValid token to NPM
GITHUB_TOKENValid token to Github

Outputs

OutputDescription
VERSIONReleased version

Example

name: Release

on:
  workflow_dispatch:
   inputs:
      NEXT_VERSION:
        description: Define next version (major/minor/patch)
        required: true
      REPOSITORY_NAME:
        description: Repository full name (e.g. chrvadala/hello )
        required: true

jobs:
  build_and_release:
    runs-on: ubuntu-22.04
    if: ${{ github.event.inputs.REPOSITORY_NAME ==  github.repository }}
    steps:
      - uses: actions/checkout@v2
      - name: Release library
        uses: chrvadala/github-actions/nodejs-release-library-action@v1
        with:
          NEXT_VERSION: ${{ github.event.inputs.NEXT_VERSION }}
          NPM_TOKEN: ${{ secrets.npm_token }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

gh-pages-publish-action

This composite action allows us to publish and update a website hosted on gh-pages. Main steps:

Inputs

InputDescription
GITHUB_TOKENValid token to Github

Outputs

No available outputs

Example

name: Website

on:
  push:
      branches:
        - main

jobs:
  build_and_publish:
    name: Publish Github Pages Website
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      - uses: chrvadala/github-actions/gh-pages-publish-action@v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Contributors