Skip to content

Update

Update #7

Workflow file for this run

#
# This source file is part of the Stanford Spezi open-source project
#
# SPDX-FileCopyrightText: 2024 Stanford University
#
# SPDX-License-Identifier: MIT
#
name: Release
on:
release:
types: [published]
push:
branches:
- fixReleaseNotes
concurrency:
group: production
cancel-in-progress: false
jobs:
formatreleasenotes:
name: Format Release Notes
runs-on: ubuntu-latest
outputs:
releasenotes: ${{ steps.releasenotes.outputs.releasenotes }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Dependencies
run: pip install requests
- name: Fetch and Process releasenotes
id: releasenotes
run: |
python <<EOF
import re
import os
import requests
# Fetch release notes from the GitHub API
RELEASE_TAG = "2.0.1"
REPO = "StanfordBDHG/ENGAGE-HF-iOS"
URL = f"https://api.github.com/repos/{REPO}/releases/tags/{RELEASE_TAG}"
response = requests.get(URL)
release = response.json()
releasenotes = release.get('body', '')
# Extract the "What's Changed" section
match = re.search(r"(## What's Changed.*?)(\n##|$)", changelog, flags=re.DOTALL)
if match:
changelog = match.group(1)
else:
changelog = "Bug fixes and performance improvements."
# Remove all Markdown formatting (optional, customize as needed)
changelog = re.sub(r'^#+\s*', '', changelog, flags=re.MULTILINE) # Remove all headers
changelog = re.sub(r'\*\*|__|\*|_', '', changelog) # Remove bold, italics, etc.
changelog = re.sub(r'\[(.*?)\]\((.*?)\)', r'\1', changelog) # Remove links but keep text
changelog = re.sub(r'https://github\.com/[^/]+/[^/]+/pull/(\d+)', r'#\1', changelog) # Shorten pull request URLs
# Remove excess blank lines
changelog = re.sub(r'\n\s*\n', '\n', changelog).strip()
# Write cleaned changelog to GITHUB_OUTPUT
with open(os.environ['GITHUB_OUTPUT'], 'a') as output_file:
output_file.write(f"changelog<<EOF\n{changelog}\nEOF\n")
EOF
- name: Formatted Release Notes
run: |
echo "Formatted Release Notes:"
echo "${{ steps.releasenotes.outputs.releasenotes }}"
# build-and-test:
# name: Build and Test
# uses: ./.github/workflows/deployment.yml
# needs: formatreleasenotes
# permissions:
# contents: read
# checks: write
# actions: read
# security-events: write
# secrets: inherit
# with:
# environment: production
# version: ${{ github.event.release.tag_name }}
# releasenotes: ${{ needs.formatreleasenotes.outputs.releasenotes }}