Merge pull request #26 from ImagingDataCommons/changelog-release-notes #13
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: Create Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Extract version from tag | |
| id: version | |
| run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Extract CHANGELOG entry for release notes | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| # Print the body of the "## [VERSION] - ..." section, up to the next "## [" heading. | |
| awk -v ver="$VERSION" ' | |
| $0 ~ "^## \\[" ver "\\]" { found = 1; next } | |
| found && /^## \[/ { exit } | |
| found { print } | |
| ' CHANGELOG.md | sed '/./,$!d' > release_notes.md | |
| if [ ! -s release_notes.md ]; then | |
| echo "Error: CHANGELOG.md does not contain an entry for version $VERSION" | |
| echo "Please add a section like: ## [$VERSION] - $(date +%Y-%m-%d)" | |
| exit 1 | |
| fi | |
| echo "Extracted release notes for $VERSION:" | |
| cat release_notes.md | |
| - name: Create skill zip | |
| run: | | |
| zip -r imaging-data-commons-${{ steps.version.outputs.version }}.zip \ | |
| SKILL.md \ | |
| references/ \ | |
| scripts/ | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| name: v${{ steps.version.outputs.version }} | |
| body_path: release_notes.md | |
| generate_release_notes: true | |
| files: imaging-data-commons-${{ steps.version.outputs.version }}.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |