Skip to main content

CI Integration

PR & branch workflow

CI release pipeline

GitHub Actions

Minimal setup

Install relctl via the official action, then use it in your steps:

- uses: layer87-labs/relctl-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Create release
run: relctl release create --merge-sha ${{ github.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Full release workflow

Three-job pattern: create draft → build matrix → publish with assets.

.github/workflows/release.yaml
name: Publish Release

on:
push:
branches:
- main

jobs:
create_release:
runs-on: ubuntu-latest
outputs:
release-id: ${{ steps.tag.outputs.RELCTL_RELEASE_ID }}
version: ${{ steps.tag.outputs.RELCTL_NEXT_VERSION }}
steps:
- uses: actions/checkout@v6

- uses: layer87-labs/relctl-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Create release
id: tag
run: relctl release create --merge-sha ${{ github.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build:
runs-on: ubuntu-latest
needs: create_release
strategy:
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v6

- uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Build ${{ matrix.arch }}
run: make VERSION="${{ needs.create_release.outputs.version }}"
env:
GOOS: linux
GOARCH: ${{ matrix.arch }}

- uses: actions/cache@v4
with:
path: out/
key: build-${{ github.sha }}-${{ matrix.arch }}

publish_release:
runs-on: ubuntu-latest
needs: [create_release, build]
steps:
- uses: actions/checkout@v6

- uses: layer87-labs/relctl-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/cache@v4
with:
path: out/
key: build-${{ github.sha }}-amd64

- uses: actions/cache@v4
with:
path: out/
key: build-${{ github.sha }}-arm64

- name: Publish release
run: |
relctl release publish \
--release-id "$RELCTL_RELEASE_ID" \
--asset "file=out/myapp_${{ needs.create_release.outputs.version }}_linux-amd64" \
--asset "file=out/myapp_${{ needs.create_release.outputs.version }}_linux-arm64"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELCTL_RELEASE_ID: ${{ needs.create_release.outputs.release-id }}

Step outputs

After relctl release create, these outputs are set in $GITHUB_OUTPUT:

VariableDescription
RELCTL_NEXT_VERSIONComputed next SemVer version
RELCTL_RELEASE_IDGitHub release ID of the draft
RELCTL_PR_SHAFull merge commit SHA
RELCTL_PR_SHA_SHORTShort (7-char) merge commit SHA

Hotfix release

- name: Create hotfix release
run: relctl release create --hotfix --merge-sha ${{ github.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Force a specific bump

- name: Create release (force minor bump)
run: relctl release create --patch-level minor --merge-sha ${{ github.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Jenkins Pipeline

pipeline {
environment {
GITHUB_REPOSITORY = 'my-org/my-repo'
GITHUB_TOKEN = credentials('github-token')
}
stages {
stage('Install relctl') {
steps {
sh '''
curl -fsSL -o relctl \
https://github.com/layer87-labs/relctl/releases/latest/download/relctl_linux-amd64
chmod +x relctl
mv relctl /usr/local/bin/relctl
'''
}
}
stage('Create Release') {
steps {
sh 'relctl release create'
}
}
}
}

Required Jenkins environment variables:

VariableSource
CISet automatically by Jenkins
JENKINS_URLSet automatically by Jenkins
GIT_URLSet by the GitHub Plugin
GITHUB_REPOSITORYMust be set manually (owner/repo)
GITHUB_TOKENSet via credentials binding