Skip to content

Commit

Permalink
Add zenodo badge in the release summary notes (#2838)
Browse files Browse the repository at this point in the history
* Add zenodo badge in the release summary notes

* Add fail_on_unmatched_files condition to false

* Fix redirect url

* add step to sleep for 30 seconds

* Update sleep timer
  • Loading branch information
KasukabeDefenceForce authored Oct 8, 2024
1 parent 1c3befd commit 16354d0
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,53 @@ jobs:
python .ci-helpers/get_next_version.py
echo "NEW_TAG=$(python .ci-helpers/get_next_version.py)" >> $GITHUB_ENV
- name: Initialize release
uses: softprops/action-gh-release@v1
with:
name: TARDIS v${{ env.NEW_TAG }}
tag_name: release-${{ env.NEW_TAG }}
body: "This release has been created automatically by the TARDIS continuous delivery pipeline."
draft: false

- name: Wait for Zenodo to update the latest release
run: sleep 120

- name: Fetch Latest DOI from Zenodo
id: fetch-doi
run: |
CONCEPT_DOI="592480"
# Make the API request for BibTeX format, following redirects
response=$(curl -s -L -H "Accept: application/x-bibtex" "https://zenodo.org/api/records/${CONCEPT_DOI}")
# Extract the full DOI value correctly
doi=$(echo "$response" | grep -oP 'doi\s*=\s*{([^}]+)}' | grep -oP '\{([^}]+)\}' | sed 's/[{}]//g')
# Extract the DOI URL directly from the response
url=$(echo "$response" | grep -oP 'url\s*=\s*{([^}]+)}' | grep -oP '\{([^}]+)\}' | sed 's/[{}]//g')
echo "Extracted DOI: ${doi}"
echo "Extracted URL: ${url}"
# Create DOI badge using the full DOI value
doi_badge="[![DOI Badge](https://img.shields.io/badge/DOI-${doi}-blue)](${url})"
# Store results in GitHub environment variables
echo "doi_badge=${doi_badge}" >> $GITHUB_ENV
echo "doi_url=${url}" >> $GITHUB_ENV
- name: Generate and process changelog
run: |
CHANGELOG=$(git cliff --config pyproject.toml --unreleased | sed -n '/^## Changelog/,$p' | grep -vE '^(ERROR|WARN)')
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create new release
- name: Update release with changelog and DOI
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.BOT_TOKEN }}
name: TARDIS v${{ env.NEW_TAG}}
tag_name: release-${{ env.NEW_TAG }}
prerelease: false
body: |
This release has been created automatically by the TARDIS continuous delivery pipeline.
${{ env.doi_badge }}
${{ env.CHANGELOG }}
A complete list of changes for this release is available at [CHANGELOG.md](https://github.com/tardis-sn/tardis/blob/master/CHANGELOG.md).
Expand All @@ -64,3 +94,4 @@ jobs:
conda-osx-64.lock
conda-lock.yml
fail_on_unmatched_files: false
draft: false

0 comments on commit 16354d0

Please sign in to comment.