-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add automatic patch release generation #551
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: Generate patch releases | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# First day of every month | ||
- cron: '0 0 1 * *' | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
latest_branch: ${{steps.latest_branch.outputs.latest_branch}} | ||
branches_json: ${{steps.release_branches.outputs.branches_json}} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get latest llvm_release branch | ||
id: latest_branch | ||
run: | | ||
git branch -r \ | ||
| grep 'ocl-open-' \ | ||
| sed -E 's/.*\/ocl-open-([0-9]+)/\1/' \ | ||
| sort -n -r \ | ||
| head -1 \ | ||
| xargs printf "latest_branch=ocl-open-%s" \ | ||
>> $GITHUB_OUTPUT | ||
- name: Get branch list | ||
id: release_branches | ||
run: | | ||
git branch -r \ | ||
| grep "origin/ocl-open-" \ | ||
| sed -E 's/\ *origin\/([^\ ]*)/\"\1\"/' \ | ||
| paste -sd',' \ | ||
| xargs -0 -d"\n" printf 'branches_json={"branch":[%s]}' \ | ||
>> $GITHUB_OUTPUT | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
strategy: | ||
matrix: ${{fromJson(needs.setup.outputs.branches_json)}} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ matrix.branch }} | ||
fetch-depth: 0 | ||
- name: Get commits info | ||
id: versions | ||
run: | | ||
export LATEST_VERSION=\ | ||
"$(git describe --tags --abbrev=0 --match 'v*')" | ||
export LLVM_VERSION=$(echo $LATEST_VERSION \ | ||
| sed -E 's/v([0-9]+\.[0-9]+)\.([0-9]+).*/\1/') | ||
export PATCH=$(echo $LATEST_VERSION \ | ||
| sed -E 's/(v[0-9]+\.[0-9]+)\.([0-9]+).*/\2/') | ||
echo "llvm_version=$LLVM_VERSION" >> $GITHUB_OUTPUT | ||
echo "patch=$PATCH" >> $GITHUB_OUTPUT | ||
echo "latest_version=${LATEST_VERSION}" >> $GITHUB_OUTPUT | ||
echo "release_version=${LLVM_VERSION}.$((${PATCH}+1))" \ | ||
>> $GITHUB_OUTPUT | ||
git rev-list ${LATEST_VERSION}..HEAD --count \ | ||
| xargs printf "commits_since_last_release=%d\n" >> $GITHUB_OUTPUT | ||
git rev-parse HEAD | xargs printf "last_commit=%s\n" >> $GITHUB_OUTPUT | ||
- name: Get SPIRV-LLVM-Translator and llvm-project latest tags | ||
id: llvm-spirv-versions | ||
run: | | ||
export SPIRV_PATCH=\ | ||
$(git ls-remote --tags \ | ||
"https://github.com/KhronosGroup/SPIRV-LLVM-Translator" \ | ||
"refs/tags/v${{ steps.versions.outputs.llvm_version }}.[0-9]" \ | ||
"refs/tags/v${{ steps.versions.outputs.llvm_version }}.[0-9][0-9]" \ | ||
| awk '{print $2}' \ | ||
| sed -E 's/refs\/tags\/v${{ steps.versions.outputs.llvm_version }}.([0-9]+)/\1/' \ | ||
| sort -n \ | ||
| tail -1) | ||
echo "spirv_patch=${SPIRV_PATCH}" >> $GITHUB_OUTPUT | ||
export LLVM_PATCH=\ | ||
$(git ls-remote --tags \ | ||
"https://github.com/llvm/llvm-project" \ | ||
"refs/tags/llvmorg-${{ steps.versions.outputs.llvm_version }}.[0-9]" \ | ||
"refs/tags/llvmorg-${{ steps.versions.outputs.llvm_version }}.[0-9][0-9]" \ | ||
| awk '{print $2}' \ | ||
| sed -E 's/refs\/tags\/llvmorg-${{ steps.versions.outputs.llvm_version }}.([0-9]+)/\1/' \ | ||
| sort -n \ | ||
| tail -1) | ||
echo "llvm_patch=${LLVM_PATCH}" >> $GITHUB_OUTPUT | ||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
if: ${{ steps.versions.outputs.commits_since_last_release != 0 }} | ||
with: | ||
# Setting tag to have format: | ||
# %latest llvm version%.%latest patch + 1% | ||
tag_name: v${{ steps.versions.outputs.release_version }} | ||
# We have to set this so tag is set on the branch we are releasing | ||
target_commitish: ${{ steps.versions.outputs.last_commit }} | ||
# We don't want to mark patch releases latest unless it is latest | ||
# major version | ||
make_latest: >- | ||
${{ needs.setup.outputs.latest_branch == matrix.branch }} | ||
name: > | ||
opencl-clang linked against LLVM | ||
v${{ steps.versions.outputs.llvm_version }} | ||
libraries | ||
# TODO: update | ||
body: "This release is linked against LLVM \ | ||
v${{ steps.versions.outputs.llvm_version }}.${{ steps.llvm-spirv-versions.outputs.llvm_patch }} \ | ||
and SPIR-V LLVM translator \ | ||
v${{ steps.versions.outputs.llvm_version }}.${{ steps.llvm-spirv-versions.outputs.spirv_patch }}. \ | ||
Full Changelog: ${{ github.server_url }}/\ | ||
${{ github.repository }}/compare/\ | ||
${{ steps.versions.outputs.latest_version }}...\ | ||
v${{ steps.versions.outputs.release_version }}" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it right that a new release won't be created if there is no change in an opencl-clang branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's correct