Skip to content

Commit ec826c5

Browse files
ZzEeKkAasys-ce-bb
authored andcommitted
Add automated release workflow (#2586)
Some of the upstream PRs are getting backported to the llvm_release_* branches, but those changes are never released. That prevents them from distributing as precompiled packages in various distributions like conda-forge and others. This PR targets this issue by creating automated workflow that is triggered once a month and generates automated releases for each such branch if there were changes since last release. This PR Adds workflow to generate releases every month from llvm_release_* branches in the format %llvm_major%.%llvm_minor%.%latest patch version +1%. For example: v18.1.1 v17.0.2 v17.0.1 v14.0.1 etc Release description matches as close as possible to current releases. The only difference is that llvm versions is represented by two numbers, instead of three, because it is impossible to recover exact version. You can check out example of generated versions here (there are few releases from the original proposal): https://github.com/ZzEeKkAa/SPIRV-LLVM-Translator/releases Workflow is set to be triggered once a month. It is also possible to trigger it manually from github actions UI. Merge process Merge the PR to main Trigger workflow manually Note There is no need to backport changes to all branches, since workflow dispatch on schedule basis can be performed only from main branch. Fixes: #1898 Fixes: #1508 Original commit: KhronosGroup/SPIRV-LLVM-Translator@63e89a9a268e5c2
1 parent eaea1d8 commit ec826c5

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Automated release
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# First day of every month
7+
- cron: '0 0 1 * *'
8+
9+
jobs:
10+
setup:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
latest_branch: ${{steps.latest_branch.outputs.latest_branch}}
14+
branches_json: ${{steps.release_branches.outputs.branches_json}}
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- name: Get latest llvm_release branch
21+
id: latest_branch
22+
run: |
23+
git branch -r \
24+
| grep 'llvm_release_' \
25+
| sed -E 's/.*\/llvm_release_([0-9]+)/\1/' \
26+
| sort -n -r \
27+
| head -1 \
28+
| xargs printf "latest_branch=llvm_release_%s" \
29+
>> $GITHUB_OUTPUT
30+
- name: Get branch list
31+
id: release_branches
32+
run: |
33+
git branch -r \
34+
| grep "origin/llvm_release_" \
35+
| sed -E 's/\ *origin\/([^\ ]*)/\"\1\"/' \
36+
| paste -sd',' \
37+
| xargs -0 -d"\n" printf 'branches_json={"branch":[%s]}' \
38+
>> $GITHUB_OUTPUT
39+
release:
40+
runs-on: ubuntu-latest
41+
needs: setup
42+
strategy:
43+
matrix: ${{fromJson(needs.setup.outputs.branches_json)}}
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
with:
48+
ref: ${{ matrix.branch }}
49+
fetch-depth: 0
50+
- name: Get commits info
51+
id: versions
52+
run: |
53+
export LATEST_VERSION=\
54+
"$(git describe --tags --abbrev=0 --match 'v*')"
55+
export LLVM_VERSION=$(echo $LATEST_VERSION \
56+
| sed -E 's/(v[0-9]+\.[0-9]+)\.([0-9]+).*/\1/')
57+
export PATCH=$(echo $LATEST_VERSION \
58+
| sed -E 's/(v[0-9]+\.[0-9]+)\.([0-9]+).*/\2/')
59+
60+
echo "llvm_version=$LLVM_VERSION" >> $GITHUB_OUTPUT
61+
echo "patch=$PATCH" >> $GITHUB_OUTPUT
62+
echo "latest_version=${LATEST_VERSION}" >> $GITHUB_OUTPUT
63+
echo "release_version=${LLVM_VERSION}.$((${PATCH}+1))" \
64+
>> $GITHUB_OUTPUT
65+
66+
git rev-list ${LATEST_VERSION}..HEAD --count \
67+
| xargs printf "commits_since_last_release=%d\n" >> $GITHUB_OUTPUT
68+
git rev-parse HEAD | xargs printf "last_commit=%s\n" >> $GITHUB_OUTPUT
69+
- name: Release
70+
uses: softprops/action-gh-release@v2
71+
if: ${{ steps.versions.outputs.commits_since_last_release != 0 }}
72+
with:
73+
# Setting tag to have format:
74+
# %latest llvm version%.%latest patch + 1%
75+
tag_name: ${{ steps.versions.outputs.release_version }}
76+
# We have to set this so tag is set on the branch we are releasing
77+
target_commitish: ${{ steps.versions.outputs.last_commit }}
78+
# We don't want to mark patch releases latest unless it is latest
79+
# major version
80+
make_latest: >-
81+
${{ needs.setup.outputs.latest_branch == matrix.branch }}
82+
name: >
83+
SPIR-V LLVM translator based on LLVM
84+
${{ steps.versions.outputs.llvm_version }}
85+
body: "Full Changelog: ${{ github.server_url }}/\
86+
${{ github.repository }}/compare/\
87+
${{ steps.versions.outputs.latest_version }}...\
88+
${{ steps.versions.outputs.release_version }}"

llvm-spirv/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,9 @@ LLVM/Clang release and there are no objections from the maintainer(s). There
256256
is no guarantee that older release branches are proactively kept up to date
257257
with main, but you can request specific commits on older release branches by
258258
creating a pull request or raising an issue on GitHub.
259+
260+
## Releasing strategy
261+
262+
As mentioned earlier there are branches `llvm_release_*` that get backported
263+
changes. Those changes if exists are released automatically by github CI on
264+
monthly basis in a format `<llvm_major>.<llvm_minor>.<latest patch +1>`.

0 commit comments

Comments
 (0)