workflow adjusted #1
Workflow file for this run
This file contains hidden or 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
| name: Deploy to GitHub | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - "*" | |
| jobs: | |
| tag: | |
| name: Deploy Plugin Tag | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Debug File List | |
| run: ls -R | |
| - name: Install SVN (Subversion) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install subversion | |
| - name: Find Readme File | |
| id: find_readme | |
| run: | | |
| readme_file=$(find . -type f -iname "readme.*" | head -n 1) | |
| if [ -n "$readme_file" ]; then | |
| echo "Readme file found: $readme_file" | |
| echo "readme_file=$readme_file" >> $GITHUB_ENV | |
| else | |
| echo "::error::Readme file not found." | |
| exit 1 | |
| fi | |
| - name: Extract Release Notes | |
| id: release_notes | |
| run: | | |
| # Define variables | |
| changelog_section_start="== Changelog ==" | |
| current_tag="${{ github.ref_name }}" | |
| readme_file="${{ env.readme_file }}" | |
| # Extract version from tag (strip 'refs/tags/' if it exists) | |
| version=${current_tag#refs/tags/} | |
| # Initialize variables | |
| in_changelog=0 | |
| capturing_version=0 | |
| release_notes="" | |
| while IFS= read -r line; do | |
| # Start capturing after finding the changelog section | |
| if [[ "$line" == "$changelog_section_start" ]]; then | |
| in_changelog=1 | |
| continue | |
| fi | |
| # Skip lines before the changelog section | |
| if [[ $in_changelog -eq 0 ]]; then | |
| continue | |
| fi | |
| # Start capturing if the line matches the current version | |
| if [[ "$line" == "= $version =" ]]; then | |
| capturing_version=1 | |
| release_notes+="$line\n" | |
| continue | |
| fi | |
| # Stop capturing when a new version is detected | |
| if [[ $capturing_version -eq 1 && "$line" =~ ^= ]]; then | |
| break | |
| fi | |
| # Add the line to the release notes if we are capturing | |
| if [[ $capturing_version -eq 1 ]]; then | |
| release_notes+="$line\n" | |
| fi | |
| done < "$readme_file" | |
| # Check if release notes were extracted | |
| if [[ -z "$release_notes" ]]; then | |
| echo "::error::Failed to extract release notes for version $version." | |
| exit 1 | |
| fi | |
| # Debug: Print extracted release notes | |
| echo "Extracted release notes for version $version:" | |
| printf "%b" "$release_notes" | |
| # Set output for release notes | |
| echo "::set-output name=notes::$(printf "%b" "$release_notes")" | |
| - name: Debug Release Notes | |
| run: | | |
| echo "Debugging Release Notes:" | |
| echo "${{ steps.release_notes.outputs.notes }}" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| body: ${{ steps.release_notes.outputs.notes }} | |
| files: ${{github.workspace}}/${{ github.event.repository.name }}.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |