Skip to content

Commit

Permalink
More keep stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed Feb 19, 2024
1 parent 70e5be2 commit 50209a8
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 47 deletions.
50 changes: 4 additions & 46 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,17 @@ jobs:
apt:
- graphviz
- linux: py39-oldestdeps
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

allowed-fail-tests:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
coverage: 'codecov'
envs: |
- linux: py311-devdeps
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

publish:
needs: [tests]
Expand All @@ -64,52 +68,6 @@ jobs:
secrets:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}

make_gh_release:
name: Make a Github release
needs: [publish]
if: startsWith(github.event.ref, 'refs/tags/v') && !endsWith(github.event.ref, '.dev')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Convert to markdown with pandoc
uses: docker://dalibo/pandocker:latest
with:
args: >- # allows you to break string into multiple lines
--wrap=none
-t markdown_strict
--output=release-changelog.md
--filter .github/changelog_filter.py
CHANGELOG.rst
- name: Capture Markdown Changelog
id: markdown-changelog
run: |
{
echo 'content<<EOF'
cat release-changelog.md
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Show converted changelog
run: |
echo '${{ steps.markdown-changelog.outputs.content }}'
- name: Create GitHub Release
uses: actions/github-script@v7
id: create-release
with:
script: |
return await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: "${{ github.ref_name }}",
name: "${{ github.ref_name }}",
body: `${{ steps.markdown-changelog.outputs.content }}`
});
notify:
if: always() && github.event_name != 'pull_request' && github.ref_name == 'main'
needs: [tests, allowed-fail-tests, publish]
Expand Down
37 changes: 36 additions & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,28 @@ jobs:
- name: Install towncrier
run: python -m pip install --upgrade towncrier

- name: Run towncrier in draft to capture the output
run: towncrier build --draft --version ${{ inputs.version }} --yes > release-changelog.rst

- name: Debug release-changelog.rst
run: cat release-changelog.rst

- name: Capture Markdown Changelog
id: markdown-changelog
run: |
{
echo 'content<<EOF'
cat release-changelog.md
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Debug md changelog
run: |
echo "${{ steps.markdown-changelog.outputs.content }}"
- name: Run towncrier
run: |
towncrier build --version ${{ inputs.version }} ${{ inputs.tc_keep && '--keep' || '--yes' }}
towncrier build --version ${{ inputs.version }} ${{ inputs.tc_keep && '--yes' || '--keep' }}
- name: Commit Changelog
run: |
Expand All @@ -77,5 +96,21 @@ jobs:
title: 'Prepare for release of v${{ inputs.version }}'
body: |
This PR renders the changelog and updates the JSON attrs before release of v${{ inputs.version }}.
A draft release has been made with the changelog, release it after merge to trigger the release.
labels: |
no changelog
- name: Create draft GitHub Release
uses: actions/github-script@v7
id: create-release
with:
script: |
return await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: "${{ inputs.version }}",
name: "${{ inputs.version }}",
body: `${{ steps.markdown-changelog.outputs.content }}`
draft: true
});

0 comments on commit 50209a8

Please sign in to comment.