A collection of GitHub actions for use within ottofeller projects.
Provides the following functionality:
- Check out a repo
- Setting up a distribution of the requested Node.js version
- Install an app
- Run an npm script
- The dir to the app may be specified
The action sets up node, installs npm packages and runs a command supplied in inputs, see action.yml. See test-npm-run.yml for an example of the action usage.
NOTE: You do not need to check out the repo before running the action. Moreover if you do check it out, the result will be thrown away as the action checks out from a provided ref (with default branch as a fallback).
Basic:
steps:
- uses: ottofeller/github-actions/npm-run@main
with:
command: npm run test:all -- --verboseAdvanced:
steps:
- uses: ottofeller/github-actions/npm-run@main
with:
node-version: 16
registry-url: https://npm.pkg.github.com/
scope: @npmscope
directory: app
command: npm run test:all -- --verboseThe node-version, registry-url, scope inputs are optional and are similar to those in the setup-node action. The latter is used under the hood and the inputs are fed into setup action. See setup-node docs for details.
The directory is optional and defaults to ./.
The only required input is command which is the command that will be run in bash after installation of node and dependencies.
Provides the following functionality:
- Check out a repo
- Find the latest tag and bumps it with a new patch version
- Creates a draft release with the new tag
- Outputs ID of the created release
The action searches your repo for the most recent tag and creates a new one with patch update, then a draft release is created for the tag, see action.yml. See test-create-release.yml for an example of the action usage.
Basic:
steps:
- uses: ottofeller/github-actions/create-release@main
with:
initial-version: 0.0.1
release-branches: main,master,dev
bump-level: minor
github-token: ${{ secrets.GITHUB_TOKEN }}Advanced:
steps:
- uses: ottofeller/github-actions/create-release@main
with:
initial-version: 0.0.1
release-branches: main,master,dev
bump-level: minor
github-token: ${{ secrets.GITHUB_TOKEN }}
update-main-package_json: true
update-children-path: |
packages/first
packages/second
packages/third
update-children-bump-level: |
minor
none
patchinitial-version and release-branches inputs are used in anothrNick/github-tag-action@1.36.0 action and have similar semantics. See github-tag-action docs for details.
initial-versionis optional and defaults to0.0.1release-branchesis a comma separated list of branches to create a release from, optional and defaults tomainbump-levelis a level of version to bump which might be one ofmajor,minor,patchand defaults topatchgithub-tokenis required and represents your GitHub token which is used for accessing the repo.update-root-package_jsonis an optional flag that triggerspackage.jsonversion update in the root folder. Defaults tofalse.update-children-pathis optional. Usesnpm versioncommand to update version inpackage.jsonfiles within specified folders. Provide a space separated list of folder paths for each package.json file to be updated. Applies changes only ifupdate-children-bump-levelinput is provided. Defaults to empty string which effectively passes the step.update-children-bump-levelis optional. A space separated list of version update attribute ofnpm-versioncommand to be used withupdate-children-pathinput. Make sure the two lists match in length (for paths with missing values of bump-level no update will be performed). To skip updates for a package in the middle of the list passnone. Note that a specific version may be provided instead of bump level. Defaults to empty string.
Note that the last three inputs create a new commit. update-children-path and update-children-bump-level work together but independent of update-root-package_json.
- provide only
update-root-package_json: trueto bump the root package version and leave children as is; - provide
update-children-pathandupdate-children-bump-levelwithoutupdate-root-package_jsonto bump version of only the children packages and leave the root one as is; - provide the three inputs to update both root and children packages.
Obtains the commit hash of the latest release. It does:
- Search through git history and find the latest release (excluding prerelease and draft types).
- Exit with code 1 if no release was found.
- Output commit hash of the latest release if found.
The action searches your repo for the most recent release tag and outputs its commit hash, see action.yml. See test-latest-release-commit-hash.yml for an example of the action usage.
steps:
- id: commit-hash
uses: ottofeller/github-actions/latest-release-commit-hash@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ steps.commit-hash.outputs.commit_hash }}jobs:
set-commit-hash:
runs-on: ubuntu-latest
outputs:
commit_hash: ${{ steps.commit-hash.outputs.commit_hash }}
steps:
- id: commit-hash
uses: ottofeller/github-actions/latest-release-commit-hash@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lint:
needs: set-commit-hash
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ needs.set-commit-hash.outputs.commit_hash }}
- uses: ottofeller/github-actions/npm-run@main
with:
command: npm run lint- Inputs:
github-tokenis required and represents your GitHub token which is used for accessing the repo.
- Outputs:
commit_hashis the commit hash of the latest release found in the repo.
Provides the following functionality:
- Check out a repo
- Setting up a distribution of the requested Node.js version
- Install dependencies
- Publishes the package to a specified registry
The action sets up node, installs dependencies and runs an npm publish command, see action.yml. See test-publish-npm.yml for an example of the action usage.
Basic:
jobs:
...
publish-npm:
needs: [set-commit-hash, lint, test]
runs-on: ubuntu-latest
steps:
- uses: ottofeller/github-actions/publish-npm@main
with:
npm-token: ${{ secrets.NPM_TOKEN }}Advanced:
jobs:
...
publish-npm:
needs: [set-commit-hash, lint, test]
runs-on: ubuntu-latest
steps:
- uses: ottofeller/github-actions/publish-npm@main
with:
ref: ${{ needs.set-commit-hash.outputs.commit_hash }}
node-version: 18
registry-url: https://npm.pkg.github.com/
scope: "@worldcoin"
npm-token: ${{ secrets.NPM_TOKEN }}
access: restricted
include-build-step: true
directory: packages/app- The
node-version,registry-url,scopeinputs are optional and is similar tosetup-node. The latter is used under the hood and the inputs are fed into setup action. See setup-node docs for details. By defaultnode-versionis set to 16. refis optional and represents the git reference used for publishing. Used in checkout action and has the same behavior: when checking out the repository that triggered a workflow, this defaults to the reference or SHA for that event; otherwise, uses the default branch.npm-tokenis required and represents your NPM token which is used for access to the registry.accessis optional. It is used innpm publishcommand and tells the registry whether this package should be published as public or restricted. Defaults to public.include-build-stepis an optional flag for running build script (npm run buildcommand) before publishing. Defaults tofalse.dry-runis an optional flag for running thenpm publishcommand with--dry-runoption. Defaults tofalse.directoryis optional and defaults to./.
Provides the following functionality:
- Downloads mermerd tarball and extracts the executable
- Runs mermerd either with run config file or with
connectionStringCLI parameter - Checks for changes and commits the created/updated file to the repo
For detailed steps of the action see action.yml. See below for examples of the action usage.
NOTE: You do not need to check out the repo before running the action.
With run config:
steps:
- uses: ottofeller/github-actions/generate-db-diagram@main
with:
run-config: ./yourRunConfig.yamlWith connection string:
steps:
- uses: ottofeller/github-actions/generate-db-diagram@main
with:
connection-string: postgresql://user:password@localhost:5432/yourDbSpecify output filename:
steps:
- uses: ottofeller/github-actions/generate-db-diagram@main
with:
run-config: ./yourRunConfig.yaml
output-filename: diagram.mmdSpecify mermerd tarball URL:
steps:
- uses: ottofeller/github-actions/generate-db-diagram@main
with:
mermerd-tarball-url: https://github.com/KarnerTh/mermerd/releases/download/v0.3.0/mermerd_0.3.0_linux_amd64.tar.gz
run-config: ./yourRunConfig.yaml
output-filename: diagram.mmdSpecify schema and tables to use:
steps:
- uses: ottofeller/github-actions/generate-db-diagram@main
with:
connection-string: postgresql://user:password@localhost:5432/yourDb
schema: hollywood
tables: films,actors,awardsmermerd-tarball-urlis the URL to download mermerd executable from. Defaults tov0.4.1asset stored on github.run-configis the path to a run config file (YAML). If provided connection-string option is ignored.connection-stringis the connection string for the DB.schemais the schema that should be used. Default tupublic.tablesis a list of tables to include. Defaults to all tables.output-filenameis the output file name. Defaults toresult.mmd. When using run config file make sure the output matches the default one o remember to provide the custom one with this option.
Runs spectaql to get Introspection Query and generates static documentation for a GraphQL schema.
For detailed steps of the action see action.yml. See below for examples of the action usage.
NOTE: You do not need to check out the repo before running the action.
Only with an introspection-url:
steps:
- uses: ottofeller/github-actions/generate-graphql-docs@main
with:
introspection-url: https://server.graphql/introspectWith a custom config:
steps:
- uses: ottofeller/github-actions/generate-graphql-docs@main
with:
config-path: ./yourConfig.yaml
introspection-url: https://server.graphql/introspect
headers: ${{ format('{"x-access-token":"{0}"}', github.ACCESS_TOKEN) }}
target-dir: docs/graphqlconfig-pathis the path to a config file (YAML). Defaults to the config stored with the action. The latter sets only basic page info and no data for server querying. If you choose to use a custom config refer to the spectaql readme for a description of the file structure and examples.introspection-urlis the URL for an Introspection Query. Defaults tohttp://localhost:3000/.headersis an arbitrary set of headers for the Introspection Query as a JSON string. Empty by default.target-diris the output folder name. Defaults topublic.
The scripts and documentation are not licensed. However the use is restricted to Ottofeller projects.