Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .bcr/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"homepage": "https://github.com/bmw-software-engineering/trlc",
"maintainers": [
{
"email": "ambujsingh7566180876@gmail.com",
"github": "AAmbuj",
"name": "Ambuj Singh Kushwaha",
"github_user_id": 73685939
}
],
"repository": [
"github:bmw-software-engineering/trlc"
],
"versions": [],
"yanked_versions": {}
}

18 changes: 18 additions & 0 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
matrix:
platform:
- debian12
- ubuntu2204
- macos
- windows
bazel:
- 7.x
- 8.x
tasks:
verify_api_examples:
name: "Verify api-examples"
platform: ${{ platform }}
bazel: ${{ bazel }}
build_targets:
- "@trlc//api-examples/..."
test_targets:
- "@trlc//api-examples/..."
5 changes: 5 additions & 0 deletions .bcr/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "{REPO}-{VERSION}",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{TAG}.tar.gz"
}
46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish to BCR

on:
workflow_call:
inputs:
tag_name:
required: true
type: string
registry_fork:
required: false
type: string
default: AAmbuj/bazel-central-registry
secrets:
BCR_PUBLISH_TOKEN:
required: true
workflow_dispatch:
inputs:
tag_name:
description: Git tag being released
required: true
type: string
registry_fork:
description: GitHub fork used to open the BCR PR (owner/repo)
required: false
type: string
default: AAmbuj/bazel-central-registry

jobs:
publish:
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v1.2.0
with:
tag_name: ${{ inputs.tag_name }}
registry_fork: ${{ inputs.registry_fork }}
draft: true
attest: true
tag_prefix: "trlc-"
author_name: Ambuj Singh Kushwaha
author_email: ambujsingh7566180876@gmail.com
committer_name: github-actions[bot]
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
permissions:
contents: write
id-token: write
attestations: write
secrets:
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release

on:
workflow_dispatch:
inputs:
tag_name:
description: Git tag being released
required: true
type: string
registry_fork:
description: GitHub fork used to open the BCR PR (owner/repo)
required: false
type: string
default: AAmbuj/bazel-central-registry
push:
tags:
- "trlc-*"

permissions:
id-token: write
attestations: write
contents: write

jobs:
release:
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v7.4.0
with:
release_files: archives/*.*
prerelease: false
draft: true
tag_name: ${{ inputs.tag_name || github.ref_name }}
permissions:
id-token: write
attestations: write
contents: write
secrets: {}

publish:
needs: release
uses: ./.github/workflows/publish.yml
with:
tag_name: ${{ inputs.tag_name || github.ref_name }}
registry_fork: ${{ inputs.registry_fork || 'AAmbuj/bazel-central-registry' }}
secrets:
BCR_PUBLISH_TOKEN: ${{ secrets.BCR_PUBLISH_TOKEN }}

finalize:
needs: publish
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Publish draft release
run: gh release edit "$TAG" --draft=false --repo "$GITHUB_REPOSITORY"
env:
TAG: ${{ inputs.tag_name || github.ref_name }}
GH_TOKEN: ${{ github.token }}
44 changes: 44 additions & 0 deletions .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash

set -o errexit -o nounset -o pipefail

TAG="$1"
# Tags use the format "trlc-X.Y.Z"; strip the prefix to get the bare version
# matching the tag_prefix configured in publish.yml
if [[ "$TAG" == trlc-* ]]; then
VERSION="${TAG#trlc-}"
else
echo "ERROR: tag '${TAG}' does not match expected format 'trlc-X.Y.Z'" >&2
exit 1
fi

mkdir -p archives

PREFIX="trlc-${VERSION}"
ARCHIVE="archives/${TAG}.tar.gz"

git archive --format=tar --prefix="${PREFIX}/" "$TAG" | gzip > "$ARCHIVE"

SHA=$(sha256sum "$ARCHIVE" | awk '{print $1}')

cat << EOF
## Bzlmod

Add this to your MODULE.bazel:

\`\`\`starlark
bazel_dep(name = "trlc", version = "${VERSION}")
\`\`\`

## WORKSPACE

\`\`\`starlark
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "trlc",
sha256 = "${SHA}",
strip_prefix = "${PREFIX}",
url = "https://github.com/bmw-software-engineering/trlc/releases/download/${TAG}/${TAG}.tar.gz",
)
\`\`\`
EOF
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,16 @@ Optional dependency (not installed automatically):
* [Binary CVC5](https://github.com/cvc5/cvc5/releases/tag/cvc5-1.3.2)
(An alternative to PyPI CVC5, make sure to rename the binary to
`cvc5` and put it on your PATH).

## Automated Release Flow

Releases are automated through GitHub Actions:

* Push a release tag using the format `trlc-X.Y.Z`.
* Workflow `.github/workflows/release.yml` creates a draft GitHub release and uploads `trlc-{TAG}.tar.gz`.
* Workflow `.github/workflows/publish.yml` opens a Bazel Central Registry PR through `publish-to-bcr`.
* After BCR publish succeeds, the release is finalized (published), which triggers `.github/workflows/package.yml` to publish wheels to PyPI.

Required repository secret:

* `BCR_PUBLISH_TOKEN`: Classic PAT with `workflow` and `repo` scopes, with access to your BCR fork (default fork: `AAmbuj/bazel-central-registry`).
1 change: 1 addition & 0 deletions documentation/TUTORIAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
* [Advaned tips & tricks](TUTORIAL-ADVANCED-TYPES.md): some more
advanced tips and tricks for large organisations
* [Python API](TUTORIAL-API.md): writing a custom check with the API
* [Bazel Integration](TUTORIAL-BAZEL.md): using TRLC with Bazel
* [CI Integration](TUTORIAL-CI.md): tips on how to integrate in your CI