Skip to content

Latest commit

History

1,534 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

@exivity/actions

Common actions

These were originally built for use with the Exivity CI/CD workflows, but can be applied outside of the context of the Exivity repositories.

Exivity specific actions

These probably don't make much sense outside the context of the Exivity CI/CD workflows.


docker-build-push

Builds a container image and pushes it to a Docker registry. It uses the branch name as the image tag and attaches some simple opencontainers image labels. The actions also writes a metadata.json file containing some basic information about the image: component name, version (semver tag or git sha) and timestamp. This file needs to be manually copied into the image in the Dockerfile if needed.

Example

- uses: exivity/actions/docker-build-push@main

Inputs

namerequireddefaultdescription
namespaceRepository ownerThe namespace of the image repository
nameRepository nameThe name of the image repository
dockerfile"./Dockerfile"Path to the Dockerfile
registry"ghcr.io"Registry to use, e.g. "ghcr.io" (default) or "docker.io" (for Docker Hub)
usergithub.actorUsername for the Docker registry
passwordgithub.tokenPassword for the Docker registry
useSSHfalsefalseWhether to use SSH for Git operations
secretsfalseSecrets for Docker build like id=npmrc,src=$HOME/.npmrc
targetfalseSpecify a stage to build from the Dockerfile
platformsfalselinux/amd64Platforms for multi-platform builds. Requires docker buildx to be installed and configured, see https://github.com/exivity/setup-buildx-action

commit-status

Writes a commit status.

Example

- uses: exivity/actions/commit-status@mainwith:
context: auto-success

Inputs

namerequireddefaultdescription
ownerRepository ownerThe owner of the repo
repoRepository nameThe repo to write the commit status for
shaCurrent shaSha of commit to write the status for
state"success"The commit status state, can be "error", "failure", "pending" or "success"
contextA string label to differentiate this status from the status of other systems
descriptionA short description of the status
target_urlThe target URL to associate with this status
gh-tokengithub.tokenA GitHub token with write access to the component

dispatch-workflow

Triggers another workflow run. The target workflow must define the on: workflow_dispatch trigger.

The workflow should either be defined by ID or workflow filename. Look up the ID of a workflow by calling the GitHub API at:

GET https://api.github.com/repos/{owner}/{repo}/actions/workflows

Example

- uses: exivity/actions/dispatch-workflow@mainwith:
workflow:
gh-token: ${{ secrets.GITHUB_PAT }}

Inputs

namerequireddefaultdescription
ownerRepository ownerThe owner of the target repo
repoRepository nameThe target repo to dispatch the workflow in
refCurrent refThe ref to dispatch the workflow on
workflowThe workflow (by ID or filename) to dispatch
inputsThe inputs encoded as JSON string (of type Record<string, string>)
gh-tokenA GitHub PAT with write access to the target repository. The default token can't be used.

enable-automerge

Enable GitHub automerge for the current PR.

Based on original work from alexwilson/enable-github-automerge-action

Example

- uses: exivity/actions/enable-automerge@mainif: ${{ github.actor == 'dependabot[bot]' }}

Inputs

namerequireddefaultdescription
merge-methodDefault merge methodMerge method to use. Leave empty to use repository's default merge method. One of "MERGE", "SQUASH" or "REBASE".
gh-tokengithub.tokenGitHub token with write access to the repository

init-ssh

Use a private key and prime the known_hosts file with pre-loaded keys for github.com, gitlab.com and bitbucket.org.

Example

- uses: exivity/actions/init-ssh@mainwith:
private-key: ${{ secrets.PRIVATE_KEY }}

Where the PRIVATE_KEY secret contains your private key:

-----BEGIN RSA PRIVATE KEY-----
key contents
-----END RSA PRIVATE KEY-----

Inputs

namerequireddefaultdescription
private-keyThe full SSH private key

postgres

Starts a PostgreSQL server

Example

- uses: exivity/actions/postgres@mainwith:
mode: docker

Inputs

namerequireddefaultdescription
mode"host"Whether to run PostgreSQL as a Docker container or start the server installed on the host. Either "docker" or "host"
version"14.0"The PostgreSQL version to use. Only affects Docker mode (host mode always uses default version). Make sure to use a string type to avoid truncation. Available versions: "14.0", "13.0", "12.3"
password"postgres"The password for the default postgres user in de database, currently only works with host mode

process-binary

A composite action running rcedit, sign-file and virustotal (in that order).

Example

- uses: exivity/actions/process-binary@mainwith:
path: build/foo.execertificate-base64: ${{ secrets.CODESIGN_CERTIFICATE_BASE64 }}certificate-password: ${{ secrets.CODESIGN_CERTIFICATE_PASSWORD }}virustotal-api-key: ${{ secrets.VIRUSTOTAL_API_KEY }}

Inputs

See individual actions for inputs.

purge-ghcr

Delete a package version from GitHub Container Registry if a branch or tag is deleted. This is useful to clean dangling versions from ghcr.io for images built with [docker-build-push]. See .github repository for example usage.

Example

Full example workflow:

name: purge-ghcron: deletejobs:
purge-ghcr:
runs-on: ubuntu-24.04steps:
- uses: exivity/actions/purge-ghcr@mainwith:
gh-token: ${{ secrets.GITHUB_PAT }}

Inputs

namerequireddefaultdescription
orgRepository ownerThe org who owns the package
nameRepository nameThe package name
gh-tokengithub.tokenThe GitHub token with admin permissions in the organization and admin permissions to the container you want to delete

push-to-central-repo

Pushes selected files and folders to a central repository with an organized structure. This action is designed to collect files like README.md, templates, schema files, and other assets from multiple repositories and organize them in a centralized location.

Example

- uses: exivity/actions/push-to-central-repo@mainwith:
central-repo-owner: 'your-org'central-repo-name: 'central-assets'files: 'README.md,package.json'folders: 'templates,docs'gh-token: ${{ secrets.GITHUB_TOKEN }}

Directory Structure

The action creates the following structure in the central repository:

/
├── schemas/
│ ├── repo-a/
│ │ ├── foo.schema.json
│ │ └── bar.schema.json
│ └── repo-b/
│ └── baz.schema.json
├── templates/
│ ├── repo-a/
│ │ ├── template1.html
│ │ └── partials/
│ └── repo-b/
│ └── widget/
│ └── index.hbs
└── README_sources/
├── repo-a/
│ └── README.md
└── repo-b/
└── README.md
└── files/
├── repo-a/
│ └── config.json
└── repo-b/
└── settings.yaml

Inputs

namerequireddefaultdescription
central-repo-ownerOwner of the central repository
central-repo-nameName of the central repository
central-repo-branchmainBranch in central repository to push to
filesComma-separated list of files to push
foldersComma-separated list of folders to push
gh-tokenGitHub token with write access to the central repository
dry-runfalseShow what would be done without making changes

rabbitmq

Starts a RabbitMQ server in a Docker container.

Example

- uses: exivity/actions/rabbitmq@main

Inputs

namerequireddefaultdescription
version"3.8.6"The RabbitMQ version to use. Currently, only "3.8.6" is supported

rcedit

Edit resources of a Windows executable

⚠️ Currently only works on 64-bit Windows hosts

Example

- uses: exivity/actions/rcedit@mainwith:
path: build/foo.exe

Inputs

namerequireddefaultdescription
pathThe path to the file to sign, glob patterns allowed
file-description"Exivity component: $repo@$sha"File description to be presented to users
file-versionFile's version to change to
product-name"Exivity"Name of the product with which the file is distributed
product-versionProduct's version to change to
company-name"Exivity"Company that produced the executable
commentsAdditional information that should be displayed for diagnostic purposes
internal-filenameInternal name of the file. Usually, this string should be the original filename, without the extension
legal-copyright"© 2017 Exivity"Copyright notices that apply, including the full text of all notices, legal symbols, copyright dates, etc.
legal-trademarks1Trademarks and registered trademarks, including the full text of all notices, legal symbols, trademark numbers, etc.
legal-trademarks2Trademarks and registered trademarks, including the full text of all notices, legal symbols, trademark numbers, etc.
original-filenameOriginal name of the file, not including a path
iconPath to the icon file (.ico) to set as the exePath's default icon
requested-execution-levelRequested execution level to change to, must be either asInvoker, highestAvailable, or requireAdministrator
application-manifestString path to a local manifest file to use

retag-image

Pulls, tags, then pushes an image with multi-arch support. Uses docker buildx imagetools for proper multi-architecture image copying, preserving all architectures in the manifest list.

Example

- uses: exivity/actions/retag-image@mainwith:
source-tag: maintarget-tag: releasetarget-user: ${{ secrets.DOCKER_HUB_USER }}target-password: ${{ secrets.DOCKER_HUB_TOKEN }}

Params

namerequireddefaultdescription
source-registryghcr.ioSource docker registry to use
source-namespaceSource image namespace
source-nameSource image name
source-tagSource image tag
source-user${{ github.actor }}Username for source registry (optional)
source-password${{ github.token }}Password for source registry (optional)
target-registrydocker.ioTarget docker registry to use
target-namespaceTarget image namespace
target-nameTarget image name
target-tagTarget image tag
target-userUsername for target registry (optional)
target-passwordPassword for target registry (optional)
multi-archtrueEnable multi-arch support using buildx imagetools

review

Reviews a PR

Example

- uses: exivity/actions/review@mainwith:
gh-token: ${{ secrets.GITHUB_PAT }}body: Exivity bot approves everything!

Inputs

namerequireddefaultdescription
ownerRepository ownerThe owner of the repo
repoRepository nameThe repo to review a PR for
pullLatest pull request of current branchPR number to review
event"APPROVE"Choose from "APPROVE", "REQUEST_CHANGES", "COMMENT" or "PENDING"
bodyMaybeThe body of the review text, required when using "REQUEST_CHANGES" or "COMMENT"
branchCurrent branchThe head branch the pull request belongs to in order to get latest pull request, not needed if pull has been specified
gh-tokengithub.tokenA GitHub token from the PR reviewer

semantic-pull-request

Ensures your pull requests title follow the Conventional Commits spec.

See .github repository for example usage.

Based on original work from amannn/action-semantic-pull-request

Example

- uses: exivity/actions/semantic-pull-request@main

Inputs

namerequireddefaultdescription
gh-tokengithub.tokenGitHub token with read access to the repository

sign-file

Digitally sign a file

⚠️ Currently only works on Windows hosts

Example

- uses: exivity/actions/sign-file@mainwith:
path: build/foo.execertificate-base64: ${{ secrets.CODESIGN_CERTIFICATE_BASE64 }}certificate-password: ${{ secrets.CODESIGN_CERTIFICATE_PASSWORD }}

Inputs

namerequireddefaultdescription
pathThe path to the file to sign, glob patterns allowed
certificate-base64The contents of the .pfx file (PKCS#12 archive) encoded as base64 string
certificate-passwordThe password for the .pfx file
method"signtool"The signature tool to use. Available options: "signtool"

slack

Send a Slack message to the author of the commit triggering the workflow (if available).

Example

- uses: exivity/actions/slack@mainif: failure()with:
status: ${{ job.status }}slack-api-token: ${{ secrets.SLACK_BOT_TOKEN }}

Inputs

namerequireddefaultdescription
messageMaybeThe message body to send, markdown is supported. Requid when status is not set.
statusInclude a status message if set to "success", "failure" or "cancelled"
channelIf provided, send message to this channel instead of commit author. Can be a channel ID, user ID, channel name as "#channel-name" or a users display name as "@display-name"
fallback-channel"#builds"If a Slack user can't be resolved, use this channel as a fallback.
slack-api-tokenSlack API token
gh-tokengithub.tokenGitHub token with read access to the repository

sync-defaults

Syncs the repo settings with org defaults. Override org settings in a local .github/settings.yml file. See probot/settings for all available options.

See .github repository for example usage.

Based on original work from probot/settings

Example

- uses: exivity/actions/sync-defaults@mainwith:
gh-token: ${{ secrets.GITHUB_PAT }}

Inputs

namerequireddefaultdescription
gh-tokengithub.tokenGitHub token with admin access to the repository

virustotal

Analyse artefacts with VirusTotal

Forked from: crazy-max/ghaction-virustotal

Example

Build workflow:

- uses: exivity/actions/virustotal@mainwith:
path: build/foo.exevirustotal-api-key: ${{ secrets.VIRUSTOTAL_API_KEY }}

Separate check workflow:

name: virustotal-checkon:
workflow_dispatch:
schedule:
- cron: '0 3 * * *'jobs:
check:
runs-on: ubuntu-24.04steps:
- uses: exivity/actions/virustotal@mainwith:
mode: checkvirustotal-api-key: ${{ secrets.VIRUSTOTAL_API_KEY }}

Inputs

namerequireddefaultdescription
mode"analyse"Whether to analyse artefacts or check the analysis status. Either "analyse" or "check".
pathMaybeThe path to the file to analyse, glob patterns allowed. Required when mode is set to "analyse".
virustotal-api-keyThe VirusTotal API key
gh-tokengithub.tokenGitHub token used for writing commit status

accept

Triggers a scaffold repository build using the workflow_dispatch event. Does not trigger for the master or main branch.

If the current branch includes a Jira key (e.g. EXVT-1000), the scaffold build will try to resolve matching epic branches for other components.

See .github repository for example usage.

Example

- uses: exivity/actions/accept@mainwith:
gh-token: ${{ secrets.GH_BOT_TOKEN }}

Inputs

namerequireddefaultdescription
scaffold-branch"develop"The scaffold branch to build.
gh-tokengithub.tokenA GitHub token with access to the exivity/scaffold repository.
dry-runfalseIf true, scaffold will not build or run any tests.
filterIf provided, only trigger acceptance tests if files which match this input are modified. Glob patterns allowed. Multiple entries eparated by newline. If provided, and changed files do not match, writes a successful status to the commit.

db

Runs a PostgreSQL docker container, create a new database, pulls in the db repository migrations and runs them.

Example

- uses: exivity/actions/db@mainwith:
branch: some-feature-branchaws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}gh-token: ${{ secrets.GH_BOT_TOKEN }}

Inputs

namerequireddefaultdescription
branch"main" or "master" when it matches the current branch, "develop" otherwiseThe db repository branch to use.
db-name"exdb-test"The db name to create.
mode"host"Whether to run PostgreSQL as a Docker container or start the server installed on the host. Either "host" or "docker".
version"14.0"The PostgreSQL version to use. Only affects Docker mode (host mode always uses default version). Make sure to use a string type to avoid truncation. Available versions: "14.0", "13.0", "12.3"
aws-access-key-idThe AWS access key ID
aws-secret-access-keyThe AWS secret access key
gh-tokengithub.tokenA GitHub token with access to the exivity/db repository.
password"postgres"The password for the postgres user in de database, currently only works with host mode.

get-artefacts

Download artefacts for the provided component. It will use the S3 exivity bucket in the eu-central-1 region. Artefacts are downloaded with the build/{component}/{sha}[/{platform}][/{prefix}] prefix.

Example

- uses: exivity/actions/get-artefacts@mainwith:
component: dbbranch: masterpath: db-artefactsaws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}gh-token: ${{ secrets.GH_BOT_TOKEN }}

Inputs

namerequireddefaultdescription
componentComponent to download artefacts for
shaUse specific artefacts sha
branch"main" or "master" when it matches the current branch, "develop" otherwise (if available)If no sha is provided, resolve sha from branch name
use-platform-prefixfalseIf true, uses windows or linux prefix depending on current os.
prefixIf specified, download artefacts from this prefix (appended after platform prefix if specified).
path"../{component}/build"Put artefacts in this path
auto-unziptrueAutomatically unzip artefact files
aws-access-key-idThe AWS access key ID
aws-secret-access-keyThe AWS secret access key
gh-tokengithub.tokenA GitHub token with access to the exivity/{component} repository.

release

Action to help releasing Exivity.

This action controls a release repository which is used to release Exivity. Whenever a change occurs in one of the components which is ready to be release, a pull request is updated in the release repository which contains the upcoming version increase inferred from all pending changes and updates to the CHANGELOG.md. Merging this pull request will release a new version of Exivity.

The ping mode is supposed to be used by components, whenever they push to their production branch. It will trigger a prepare workflow containing the release action in prepare mode in the release repository.

The prepare mode is to be used in the release repository. It will pull in pending changes in all components, update the upcoming version and CHANGELOG.md and open a pull request with these changes.

The release mode is to be used in the release repository. It will write a new release tag in the release repository, plus new tags in all released components.

⚠️ Important Make sure to checkout the entire git history in prepare and release mode by using the checkout actions like this:

- uses: actions/checkout@v6with:
fetch-depth: 0

Examples

- uses: exivity/actions/release@mainwith:
mode: pinggh-token: ${{ secrets.GH_BOT_TOKEN }}
- uses: exivity/actions/release@mainwith:
mode: preparegh-token: ${{ secrets.GH_BOT_TOKEN }}
- uses: exivity/actions/release@mainwith:
mode: releasegh-token: ${{ secrets.GH_BOT_TOKEN }}

Inputs

namerequireddefaultdescription
mode"ping"One of "ping", "prepare" or "release"
lockfile"exivity.lock"Location of lockfile (json)
changelog"CHANGELOG.md"Location of changelog (markdown)
pr-template"NEW_RELEASE_PR_TEMPLATE.md"Location of new release PR template (markdown)
upcoming-release-branch"chore/upcoming-release"Upcoming release branch name
release-branch"main"Release branch name
dry-runfalseIf true, running this action will have no side-effects
gh-tokengithub.tokenA GitHub token with write access to all exivity repositories
jira-usernameMaybeThe Jira username (required in prepare and release mode)
jira-tokenMaybeThe Jira token (required in prepare and release mode)

The NEW_RELEASE_PR_TEMPLATE.md file will be used when opening a new pull request in the prepare step.

put-artefacts

Uploads artefacts in the provided directory. It will use the S3 exivity bucket in the eu-central-1 region. Artefacts are uploaded to the build/{component}/{sha}[/{platform}][/{prefix}] prefix.

Example

- uses: exivity/actions/put-artefacts@mainwith:
path: artefactsaws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

Inputs

namerequireddefaultdescription
componentrepo nameComponent prefix to upload artefacts under
shacurrent shaUse a specific artefacts sha
use-platform-prefixfalseIf true, uses windows or linux prefix depending on current os.
prefixIf specified, upload artefacts with this prefix (appended after platform prefix if specified).
path"build"Upload artefacts from this path.
zipfalseZip artefact files before uploading as {component_name}.tar.gz
aws-access-key-idThe AWS access key ID
aws-secret-access-keyThe AWS secret access key

Development guide

When committing code to this repository, make sure to have Node & Yarn installed since code needs to be compiled in a pre-commit hook.

To make this easier, use the devcontainer configuration included with this repo.

About

⚡ Public GitHub Actions used at Exivity for CI/CD

Resources

Contributing

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages