Common and Reusable GitHub Actions for the GEWIS organization.
Note
All inputs for the workflows should be provided as strings. However, sometimes a certain structure is expected. These are noted in the "Options" columns.
Workflow for linting, formatting, testing and building projects. Implemented for both npm/yarn and golang.
jobs:
build-and-lint-yarn:
uses: GEWIS/actions/.github/workflows/lint-and-build-npm.yml@v1
with:
node-version: "22.x"
format: true
build-and-lint-npm:
uses: GEWIS/actions/.github/workflows/lint-and-build-yarn.yml@v1
with:
node-version: "20.x"
test: true
build-and-lint-go:
uses: GEWIS/actions/.github/workflows/lint-and-build-go.yml@v1
with:
go-version: "1.24"
test: true| Input name | Description | Required | Options | Default value |
|---|---|---|---|---|
| working-directory | The directory where the project is located. | β | . |
|
| node-version | The version of Node.js to use. | β | 20.x, 22.x |
20.x |
| go-version | The version of Golang to use. | β | ^1.17.0 |
^1.24.0 |
| artifact-name | The name of the artifact to use. | β | ||
| artifact-path | The path where the artifact should be stored. | β | ||
| prepare-command | The command to run before building (and and after checkout). | β | ||
| cleanup-command | The command to run after building. | β | ||
| lint | Whether to lint the project. | β | true, false |
true |
| format | Whether to format the project. | β | true, false |
false |
| test | Whether to run tests. | β | true, false |
false |
| build | Whether to build the project. | β | true, false |
true |
Workflow for building a docker image. Useful for, for example, testing if a container build succeeds on a develop branch.
jobs:
dockerize:
uses: GEWIS/actions/.github/workflows/docker-build.yml@v1
with:
projects: '["."]'| Input name | Description | Required | Options | Default value |
|---|---|---|---|---|
| projects | Comma-separated list of projects to release. | β | ||
| docker-registry | Docker registry for base images behind authentication. | β |
| Secret name | Secret value |
|---|---|
| REGISTRY_USERNAME | The username used for the custom registry. |
| REGISTRY_PASSWORD | The password used for the custom registry. |
Workflow for building Docker images and releasing them. Can be used to push to GitHub and any other registry.
The docker-release-ghcr.yml workflow is identical to this one, but only pushes to GitHub Container Registry and does not require secrets.
jobs:
build-and-lint:
uses: GEWIS/actions/.github/workflows/docker-release.yml@v1
with:
projects: '["."]'
docker-registry: "abc.docker-registry.gewis.nl"
docker-path: "nc/aurora/core"
version: "4.0.40"
github-registry: "true"| Input name | Description | Required | Options | Default value |
|---|---|---|---|---|
| projects | Comma-separated list of projects to release. | β | ||
| version | Version of the Docker release. | β | ||
| docker-registry | The docker registry to push the build image to. | β | ||
| github-registry | Whether to push the image to the GitHub registry. | β | true, false |
false |
| env-file | Contents of the environment file to use during building. | β | ||
| docker-paths | The docker namespace, project and image name to push to. | β | ||
| build-contexts | Comma-separated extra build contexts to pass to the docker build command | β |
| Secret name | Secret value |
|---|---|
| REGISTRY_USERNAME | The username used to push to the custom registry. |
| REGISTRY_PASSWORD | The password used to push to the custom registry. |
Workflow for releasing a NPM package on npmjs.com.
Note
Make sure to include prepublishOnly: 'yarn install --frozen-lockfile && yarn build' or a prepublishOnly: npm ci && npm run build in your package.json to ensure the package is built before publishing. Since the workflow won't build by itself.
jobs:
build-and-lint:
uses: GEWIS/actions/.github/workflows/npm-release.yml@v1
with:
version: "4.0.40"
lerna: "true"| Input name | Description | Required | Options | Default value |
|---|---|---|---|---|
| node-version | The version of Node.js to use. | β | 20.x, 22.x |
20.x |
| version | Version of the NPM release. | β | ||
| lerna | Whether the project is a lerna project. | β | true, false |
false |
| Secret name | Description | Required |
|---|---|---|
| NPM_TOKEN | The token used to publish to npmjs.com. | β |
Workflow for versioning a project using semantic-release-action.
jobs:
build-and-lint:
uses: GEWIS/actions/.github/workflows/versioning.yml@v1| Input name | Description | Required | Options | Default value |
|---|---|---|---|---|
| dry-run | Whether to run a dry run of the semantic versioning. | β | string |
. |
| Output name | Description | Options | Default value |
|---|---|---|---|
| next-version | The next semantic version of the project. | string |
"" |
Example workflows for building, versioning and releasing a project can be found in the examples directory.