Skip to content

Release Plugin

Release Plugin #3

Workflow file for this run

name: Release Plugin
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Build Plugin
run: ./gradlew buildPlugin -Porg.gradle.project.pluginVersion=${{ steps.version.outputs.VERSION }}
- name: Find built zip
id: artifact
run: |
cd $GITHUB_WORKSPACE
ZIP_FILE=$(find . -path "./build/distributions/*.zip" -type f | head -1)
echo "ZIP_FILE=$ZIP_FILE"
echo "ZIP_FILE=$ZIP_FILE" >> $GITHUB_OUTPUT
- name: Extract changelog for version
id: changelog
run: |
VERSION=${{ steps.version.outputs.VERSION }}
python3 -c "
import re

Check failure on line 49 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

You have an error in your yaml syntax on line 49
with open('includes/pluginChanges.html', 'r', encoding='utf-8') as f:
content = f.read()
pattern = rf'<h3>{re.escape(VERSION)}</h3>(.*?)</ul>'
match = re.search(pattern, content, re.DOTALL)
if match:
section = match.group(1)
items = re.findall(r'<li>(.*?)</li>', section, re.DOTALL)
for item in items:
text = re.sub(r'<[^>]+>', '', item).strip()
if text:
print(f'- {text}')
else:
print('No changelog found')
" >> $GITHUB_OUTPUT
- name: Create Release
if: steps.artifact.outputs.ZIP_FILE != ''
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ steps.version.outputs.VERSION }}
body: ${{ steps.changelog.outputs }}
draft: false
prerelease: false
generate_release_notes: false
files: ${{ steps.artifact.outputs.ZIP_FILE }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}