post-release #73
This file contains 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
# For more information about TARDIS pipelines, please refer to: | |
# | |
# https://tardis-sn.github.io/tardis/contributing/development/continuous_integration.html | |
name: post-release | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: # manual trigger | |
jobs: | |
changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: tardis-sn/tardis | |
token: ${{ secrets.BOT_TOKEN }} | |
fetch-depth: 0 | |
- name: Generate a changelog | |
uses: orhun/git-cliff-action@v3 | |
with: | |
config: pyproject.toml | |
args: --verbose | |
env: | |
OUTPUT: CHANGELOG.md | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: changelog | |
path: CHANGELOG.md | |
citation: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Wait for Zenodo webhook | |
run: sleep 180 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install doi2cff | |
run: pip install git+https://github.com/citation-file-format/doi2cff | |
- name: Update CITATION.cff | |
run: | | |
rm CITATION.cff | |
doi2cff init 10.5281/zenodo.592480 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: citation | |
path: CITATION.cff | |
credits: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Wait for Zenodo webhook | |
run: sleep 180 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install rst-include | |
run: pip install rst-include==2.1.2.2 requests==2.27.1 | |
- name: Update README.rst | |
run: python .ci-helpers/update_credits.py | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: credits | |
path: | | |
README.rst | |
docs/resources/credits.rst | |
pull_request: | |
needs: [changelog, citation, credits] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: /tmp | |
- name: Copy files to repository | |
run: | | |
cp /tmp/changelog/CHANGELOG.md . | |
cp /tmp/citation/CITATION.cff . | |
cp -r /tmp/credits/* . | |
- name: Get current date | |
run: echo "DATE=$(date +'%Y.%m.%d')" >> $GITHUB_ENV | |
- uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.BOT_TOKEN }} | |
committer: TARDIS Bot <tardis.sn.bot@gmail.com> | |
author: TARDIS Bot <tardis.sn.bot@gmail.com> | |
branch: post-release-${{ env.DATE }} | |
base: master | |
push-to-fork: tardis-bot/tardis | |
commit-message: Automated changes for post-release ${{ env.DATE }} | |
title: Post-release ${{ env.DATE }} | |
body: | | |
*\*beep\* \*bop\** | |
Hi, human. | |
These are the changes required after the latest TARDIS release. | |
> :warning: **Warning:** | |
> | |
> The `post_release` workflow waits for a webhook and then updates the citation files. If the file is not modified by this pull request, please check the latest release on [Zenodo's website](https://zenodo.org/record/592480), close this pull request, and [manually run the workflow](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow). | |
> | |
> This pull request should be auto-merged. | |
labels: automated, build-docs | |
team-reviewers: tardis-infrastructure | |
id: create-pr | |
- name: Wait for pull request | |
run: sleep 30 | |
- name: Approve pull request (I) | |
run: gh pr review ${{ steps.create-pr.outputs.pull-request-number }} --approve | |
env: | |
GITHUB_TOKEN: ${{ secrets.INFRASTRUCTURE_COORDINATOR_TOKEN }} | |
if: steps.create-pr.outputs.pull-request-operation == 'created' | |
- name: Approve pull request (II) | |
run: gh pr review ${{ steps.create-pr.outputs.pull-request-number }} --approve | |
env: | |
GITHUB_TOKEN: ${{ secrets.CORE_COORDINATOR_TOKEN }} | |
if: steps.create-pr.outputs.pull-request-operation == 'created' | |
- name: Enable automerge | |
uses: peter-evans/enable-pull-request-automerge@v2 | |
with: | |
token: ${{ secrets.INFRASTRUCTURE_COORDINATOR_TOKEN }} | |
pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }} | |
merge-method: squash | |
if: steps.create-pr.outputs.pull-request-operation == 'created' |