Skip to content

Commit 9351ea2

Browse files
FWBlueWizardcursoragentrv-auditorCopilot
authored
Add release workflow (draft release, GHCR image, tag, devops dispatch) (#36)
## Summary Adds `.github/workflows/release.yml` on pushes to `release`: - **Draft GitHub release** for `v$(cat package/version)` - **Docker**: build root `Dockerfile`, push to `ghcr.io/runtimeverification/kompass` with tags `ubuntu-jammy-<package/version>` and `ubuntu-jammy-latest` (`KMIR_VERSION` from `deps/kmir_release`) - **Rollback**: delete draft release if image push fails - **Tag + publish**: tag `v<version>` from `origin/release`, finalize release, `repository_dispatch` to devops (`JENKINS_GITHUB_PAT`) for dependent updates ## Runners - `release-docker`: `[self-hosted, linux, normal]` - `tag-release`: `[self-hosted, linux, flyweight]` ## Permissions Workflow uses `contents: write` and `packages: write` for releases and GHCR. --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: devops <devops@runtimeverification.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 37dd62c commit 9351ea2

4 files changed

Lines changed: 136 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: 'Release kompass'
2+
3+
on:
4+
push:
5+
branches:
6+
- release
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: false
11+
12+
permissions:
13+
contents: write
14+
packages: write
15+
16+
jobs:
17+
draft-release:
18+
name: 'Draft Release'
19+
runs-on: ubuntu-latest
20+
outputs:
21+
version: ${{ steps.make-release.outputs.version }}
22+
steps:
23+
- name: 'Check out code'
24+
uses: actions/checkout@v4
25+
- name: 'Make release'
26+
id: 'make-release'
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
run: |
30+
set -x
31+
VERSION=v$(cat package/version)
32+
gh release create "${VERSION}" \
33+
--repo runtimeverification/kompass \
34+
--draft \
35+
--title ${VERSION} \
36+
--target ${{ github.sha }}
37+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
38+
39+
release-docker:
40+
runs-on: [self-hosted, linux, normal]
41+
needs: draft-release
42+
steps:
43+
- uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 0
46+
submodules: recursive
47+
48+
- name: 'Setup Docker Buildx'
49+
uses: docker/setup-buildx-action@v3.10.0
50+
51+
- name: 'Login to GitHub Container Registry'
52+
uses: docker/login-action@v3.4.0
53+
with:
54+
registry: ghcr.io
55+
username: ${{ github.actor }}
56+
password: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Set Image Name
59+
id: set-image-name
60+
run: |
61+
echo "image-name=ghcr.io/runtimeverification/kompass" >> $GITHUB_OUTPUT
62+
echo "kmir-version=$(cat deps/kmir_release)" >> $GITHUB_OUTPUT
63+
echo "kompass-version=$(cat package/version)" >> $GITHUB_OUTPUT
64+
echo "short-sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
65+
66+
- name: Build Kompass Container
67+
uses: docker/build-push-action@v6
68+
with:
69+
context: .
70+
file: Dockerfile
71+
platforms: linux/amd64
72+
push: true
73+
build-args: |
74+
KMIR_VERSION=${{ steps.set-image-name.outputs.kmir-version }}
75+
tags: |
76+
${{ steps.set-image-name.outputs.image-name }}:ubuntu-jammy-${{ steps.set-image-name.outputs.kompass-version }}
77+
${{ steps.set-image-name.outputs.image-name }}:ubuntu-jammy-latest
78+
79+
# Only the Docker job gates tagging; rollback the draft if the primary artifact never shipped.
80+
- name: 'On failure, delete drafted release'
81+
if: failure()
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
run: |
85+
set -x
86+
VERSION="${{ needs.draft-release.outputs.version }}"
87+
gh release delete ${VERSION} \
88+
--repo runtimeverification/kompass \
89+
--yes \
90+
--cleanup-tag
91+
92+
tag-release:
93+
runs-on: [self-hosted, linux, flyweight]
94+
needs: [release-docker]
95+
steps:
96+
- uses: actions/checkout@v4
97+
with:
98+
fetch-depth: 0
99+
submodules: recursive
100+
101+
- name: 'Configure GitHub user'
102+
run: |
103+
git config user.name devops
104+
git config user.email devops@runtimeverification.com
105+
106+
- name: Tag Release Branch
107+
run: |
108+
git tag "v$(cat package/version)" origin/release
109+
git push origin "v$(cat package/version)"
110+
111+
- name: 'Finalize Release'
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
run: |
115+
set -x
116+
VERSION=v$(cat package/version)
117+
gh release edit ${VERSION} \
118+
--repo runtimeverification/kompass \
119+
--draft=false
120+
121+
- name: 'Update dependents'
122+
run: |
123+
set -x
124+
VERSION=$(cat package/version)
125+
curl --fail \
126+
-X POST \
127+
-H "Accept: application/vnd.github+json" \
128+
-H "Authorization: Bearer ${{ secrets.JENKINS_GITHUB_PAT }}" \
129+
-H "X-GitHub-Api-Version: 2022-11-28" \
130+
https://api.github.com/repos/runtimeverification/devops/dispatches \
131+
-d '{"event_type":"on-demand-test","client_payload":{"repo":"runtimeverification/kompass","version":"'${VERSION}'"}}'

package/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.21
1+
0.1.22

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "kompass"
7-
version = "0.1.21"
7+
version = "0.1.22"
88
description = "K Semantics for the Solana ecosystem"
99
requires-python = "~=3.10"
1010
dependencies = [

uv.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)