CI/CD Templates
Copy one of the templates below into your project to get a working semrel release pipeline in under a minute. Every snippet triggers on pushes to your default branch and runs semrel release with sane defaults.
Uses the official composite action — no Node.js wrapper, just downloads and builds the Go binary for the runner.
name: Release
on: push: branches: [main]
concurrency: group: release cancel-in-progress: false
permissions: contents: write
jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: fetch-depth: 0
- uses: SemRels/semrel@v0 id: semrel with: dry-run: 'false' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Use outputs if: steps.semrel.outputs.released == 'true' run: echo "Released ${{ steps.semrel.outputs.version }}"Uses the GitLab CI release component.
include: - remote: 'https://raw.githubusercontent.com/SemRels/condition-gitlab-ci/main/templates/release.yml' inputs: dry_run: "false"Set a masked, protected SEMREL_TOKEN CI/CD variable (Settings → CI/CD → Variables) with permission to push tags and create releases.
image: golang:1.25
pipelines: branches: main: - step: name: Release script: - go install github.com/SemRels/semrel/cmd/semrel@latest - export PATH="$(go env GOPATH)/bin:$PATH" - semrel releaseAdd SEMREL_TOKEN (and any provider-specific secrets) as a secured repository variable under Repository settings → Pipelines → Repository variables.
version: 2.1
jobs: release: docker: - image: golang:1.25 steps: - checkout - run: name: Install semrel command: go install github.com/SemRels/semrel/cmd/semrel@latest - run: name: Run semrel release command: semrel release
workflows: release: jobs: - release: filters: branches: only: mainlanguage: gogo: - "1.25"
branches: only: - main
install: - go install github.com/SemRels/semrel/cmd/semrel@latest
script: - semrel releaseCommon environment variables
Section titled “Common environment variables”All templates read the same configuration file and honor these environment variables regardless of the CI platform:
| Variable | Description |
|---|---|
SEMREL_TOKEN | Token used by provider/publisher plugins (create tags, releases, comments) |
SEMREL_DRY_RUN | Set to true to simulate a release without side effects |
SEMREL_CONFIG | Override the path to .semrel.yaml |
See CI Outputs for how to consume the computed version, tag, and changelog in downstream steps across GitHub Actions and GitLab CI.