Update version #11
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
name: Update version | |
on: | |
workflow_dispatch: | |
inputs: | |
append_to_tag: | |
description: 'Leave blank for an actual release or "rc1", "rc2", ..., for release candidates."' | |
default: "" | |
schedule: | |
# Run at 10 am UTC on day-of-month 1 in January, May, and September. | |
- cron: "0 10 1 1,5,9 *" | |
jobs: | |
update-version: | |
# This workflow is only of value to PyBaMM and would always be skipped in forks | |
if: github.repository_owner == 'pybamm-team' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get current date for the first release candidate | |
if: github.event_name == 'schedule' | |
run: | | |
echo "VERSION=$(date +'v%y.%-m')rc0" >> $GITHUB_ENV | |
echo "NON_RC_VERSION=$(date +'v%y.%-m')" >> $GITHUB_ENV | |
- name: Get current date for a manual release | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
echo "VERSION=$(date +'v%y.%-m')${{ github.event.inputs.append_to_tag }}" >> $GITHUB_ENV | |
echo "NON_RC_VERSION=$(date +'v%y.%-m')" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
if: github.event_name == 'schedule' | |
with: | |
ref: 'develop' | |
- uses: actions/checkout@v4 | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
ref: '${{ env.NON_RC_VERSION }}' | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
pip install wheel | |
pip install --editable ".[all]" | |
- name: Update version | |
run: python scripts/update_version.py | |
- uses: EndBug/add-and-commit@v9 | |
if: github.event_name == 'schedule' | |
with: | |
message: 'Bump to ${{ env.VERSION }}' | |
new_branch: '${{ env.NON_RC_VERSION }}' | |
- uses: EndBug/add-and-commit@v9 | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
message: 'Bump to ${{ env.VERSION }}' | |
- name: Make a PR from ${{ env.NON_RC_VERSION }} to develop | |
uses: repo-sync/pull-request@v2 | |
with: | |
source_branch: '${{ env.NON_RC_VERSION }}' | |
destination_branch: "develop" | |
pr_title: "Sync ${{ env.NON_RC_VERSION }} and develop" | |
pr_body: "**Merge as soon as possible to avoid potential conflicts.**" | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Make a PR from ${{ env.NON_RC_VERSION }} to main | |
id: release_pr | |
if: github.event_name == 'workflow_dispatch' && !startsWith(github.event.inputs.append_to_tag, 'rc') | |
uses: repo-sync/pull-request@v2 | |
with: | |
source_branch: '${{ env.NON_RC_VERSION }}' | |
destination_branch: "main" | |
pr_title: "Make release ${{ env.NON_RC_VERSION }}" | |
pr_body: "**Check the [release workflow](https://github.com/pybamm-team/PyBaMM/blob/develop/.github/release_workflow.md)**" | |
github_token: ${{ secrets.GITHUB_TOKEN }} |