mirror of
https://github.com/open-webui/mcpo
synced 2025-06-26 18:26:58 +00:00
Create build-release.yml
This commit is contained in:
63
.github/workflows/build-release.yml
vendored
Normal file
63
.github/workflows/build-release.yml
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check for changes in pyproject.toml
|
||||
run: |
|
||||
git diff --cached --diff-filter=d pyproject.toml || {
|
||||
echo "No changes to pyproject.toml"
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Get version number from pyproject.toml
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=$(awk -F' *= *' '$1 == "version" { gsub(/"/, "", $2); print $2 }' pyproject.toml)
|
||||
echo "Detected version: $VERSION"
|
||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Extract latest CHANGELOG entry
|
||||
id: changelog
|
||||
run: |
|
||||
CHANGELOG_CONTENT=$(awk 'BEGIN {print_section=0;} /^## \[/ {if (print_section == 0) {print_section=1;} else {exit;}} print_section {print;}' CHANGELOG.md)
|
||||
CHANGELOG_ESCAPED=$(echo "$CHANGELOG_CONTENT" | sed ':a;N;$!ba;s/\n/%0A/g')
|
||||
echo "Extracted latest release notes from CHANGELOG.md:"
|
||||
echo -e "$CHANGELOG_CONTENT"
|
||||
echo "content=$CHANGELOG_ESCAPED" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Create GitHub release
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const changelog = `${{ steps.changelog.outputs.content }}`;
|
||||
const version = `${{ steps.get_version.outputs.version }}`;
|
||||
const release = await github.rest.repos.createRelease({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
tag_name: `v${version}`,
|
||||
name: `v${version}`,
|
||||
body: changelog,
|
||||
});
|
||||
console.log(`Created release ${release.data.html_url}`);
|
||||
|
||||
- name: Upload package to GitHub release
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: package
|
||||
path: |
|
||||
.
|
||||
!.git
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user