Centralized CI repository for The0mikkel.
Allows for easy management of CI pipelines, in regards to updates and new features.
The project uses Semantic versioning, and the version is determined using Semantic release.
You can use the version of the release, to lock in the version of the action that you want to use.
You may also use the sha, to lock version more securely
Please only use main
as the version, if you want to use the latest version, as it may be unstable or updated in a way that breaks your workflow.
This action will run Semantic Release to determine the next version of the package and create a new release.
Semver release pipeline requires a node project to be initiated in the repository.
Node project setup
Initialize a project with npm:
npm init -y
The following packages need to be installed:
npm install --save-dev @semantic-release/commit-analyzer @semantic-release/git @semantic-release/github @semantic-release/npm @semantic-release/release-notes-generator conventional-changelog-conventionalcommits
The following configuration needs to be added to a new file .releaserc.json
:
{
"branches": [
"main",
{
"name": "develop",
"prerelease": "r"
}
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/github",
{
"successComment": false
}
],
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
"@semantic-release/git"
]
}
This file is the default configuration and can be changed to fit the needs of the project.
A .gitignore
file should be added to the repository to ignore the node_modules
folder, created by NPM.
node_modules
GH_TOKEN
: The GitHub token to use for authentication. Defaults to the default GitHub token.
version
: The version that was released. This may be null if no release was created.
Usage of the action:
release:
name: Release
uses: the0mikkel/ci/.github/workflows/semver-release.yml@v1.1.4
This action will build a Docker image and push it to the GitHub Container Registry.
Currently, it will push to the same image name as the repository name, but allows for specifying the tags.
It by defaults sets tags for latest, sha and version numbers.
The action requires a Dockerfile to be present in the repository.
Where it is located can be specified in the action.
dockerfile
: The path to the Dockerfile. Defaults to./Dockerfile
.context
: The build context for the Docker build. Defaults to.
.args
: Build arguments to pass to the Docker build. Defaults to an empty string.
Example:VERSION=1.0.0
semver
: The version to tag the image with. Leave empty, if you don't want to tag the image with the version. Defaults to an empty string.
Example:1.0.0
or${{ steps.release.outputs.version }}
tags
: Additional tags to add to the image. Defaults totype=raw,value=${{ github.sha }}
registry
: What registry to use. Defaults to GitHub container registryghcr.io
image_name
: Name of image. Defaults to GitHub repository${{ github.repository }}
registry_username
: Username to use for registry login. Defaults to Github actor.registry_token
: Token to use for registry login. Defaults to GITHUB_TOKEN.
Usage of the action:
docker:
name: Docker
needs:
- release
uses: the0mikkel/ci/.github/workflows/docker.yml@v1.1.4
with:
semver: ${{ needs.release.outputs.version }}
This action checks if the PR title fits the Conventional commits format.
Perfect for ensuring the PR fits the Conventional commits format for Semantic release.
This action requires no specific setup in the repository.
There are not inputs for this action.
Usage of the action:
name: PR format test - Conventional commits
on:
pull_request:
types: [opened, synchronize, edited, reopened]
jobs:
pr-linter:
name: Pull Request title check
uses: the0mikkel/ci/.github/workflows/pr-test-conventionalcommits.yml@v1.1.4