A collection of common Github Actions, useful to test and publish software.
This composite action allows us to install, build and test a library. Main steps:
npm install
npm run build
(if-needed)npm test
Input | Description |
---|---|
NODE_VERSION | Node.js version to setup |
No available outputs
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 }}
This composite action allows us to release a NodeJS library to npm. Main steps:
npm ci
npm run build
(if-needed)npm version major/minor/patch
npm test
- create gh release
npm publish
Input | Description |
---|---|
NEXT_VERSION | The version that we want to release (one of major , minor , patch ) |
NPM_TOKEN | Valid token to NPM |
GITHUB_TOKEN | Valid token to Github |
Output | Description |
---|---|
VERSION | Released version |
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 }}
This composite action allows us to publish and update a website hosted on gh-pages. Main steps:
npm install
npm run build
(if-needed)npm run website:build
- publish gh-pages
Input | Description |
---|---|
GITHUB_TOKEN | Valid token to Github |
No available outputs
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 }}
- chrvadala (author)