Skip to content

Commit f733cc1

Browse files
Add Release Github-Action
1 parent 9c8f244 commit f733cc1

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

cookiecutter.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,21 @@
4545
"documentation_url": "Documentation URL, optional",
4646
"changelog_url": "URL to the changelog, optional",
4747
"issue_tracker_url": "URL to the issue tracker, optional"
48-
}
48+
},
49+
"all_repos" : [
50+
"sunpy/sunpy",
51+
"sunpy/ndcube",
52+
"sunpy/sunkit-magex",
53+
"sunpy/streamtracer",
54+
"sunpy/sunkit-dem",
55+
"sunpy/mpl-animators",
56+
"sunpy/sunkit-image",
57+
"sunpy/sunkit-pyvista",
58+
"sunpy/sunpy-soar",
59+
"sunpy/sunkit-instruments",
60+
"sunpy/drms",
61+
"sunpy/sunraster",
62+
"sunpy/sunkit-spex",
63+
"sunpy/radiospectra"
64+
]
4965
}

{{ cookiecutter.package_name }}/.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,34 @@ jobs:
122122
{%- endif %}
123123
secrets:
124124
pypi_token: {{ '${{ secrets.pypi_token }}' }}
125+
{%- if cookiecutter.github_repo in cookiecutter.all_repos %}
126+
release:
127+
if: startsWith(github.ref, 'refs/tags/v')
128+
runs-on: ubuntu-latest
129+
permissions:
130+
contents: write
131+
actions: none
132+
checks: none
133+
deployments: none
134+
steps:
135+
- name: Checkout repository
136+
uses: actions/checkout@v3
137+
- name: Install Pandoc
138+
run: sudo apt-get update && sudo apt-get install -y pandoc
139+
- name: Generate GitHub Release Notes
140+
run: |
141+
pip install bleach
142+
pandoc --wrap=none -t markdown_strict CHANGELOG.rst > notes.md
143+
python3 -c "import bleach, sys; print(bleach.clean(sys.stdin.read()))" < notes.md > release_notes.md
144+
{ echo "RELEASE_BODY<<EOF"; cat release_notes.md; echo "EOF"; } >> $GITHUB_ENV
145+
- name: Create GitHub Release
146+
uses: "actions/[email protected]"
147+
env:
148+
GITHUB_TOKEN: {{ '${{ secrets.GITHUB_TOKEN }}' }}
149+
with:
150+
tag_name: {{ '${{ github.ref }}' }}
151+
release_name: {{ '${{ github.ref_name }}' }}
152+
body: {{ '${{ env.RELEASE_BODY }}' }}
153+
draft: false
154+
prerelease: false
155+
{%- endif %}

0 commit comments

Comments
 (0)