Skip to content

Allow negative delays in trace_utilities.delay #2182

Allow negative delays in trace_utilities.delay

Allow negative delays in trace_utilities.delay #2182

name: Build and publish
on:
pull_request:
workflow_dispatch:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get the master branch (for checks)
uses: actions/checkout@v4
with:
ref: 'refs/heads/master'
- uses: actions/checkout@v4
- name: Set up Python 3.7
uses: actions/setup-python@v5
with:
python-version: 3.7
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('NuRadioMC/test/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
# poetry recommends using curl to install - probably doesn't make a difference though?
- name: Build NuRadioMC # let's always build - maybe this will occasionally catch errors
run: poetry build
- name: Check if version is updated
if: ${{ github.ref != 'refs/heads/master'}} # don't run if we're on master
run: |
git checkout master
export master_version=$(poetry version)
git checkout $GITHUB_SHA
if [ "$master_version" = "$(poetry version)" ]
then
echo Version number is the same as existing release. Please update the version number!
exit 1
fi
- name: Publish distribution 📦 to Test PyPI
if: ${{ github.ref == 'refs/heads/master'}} # only runs if the push is to master
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: ${{ github.ref == 'refs/heads/master'}} # only runs if the push is to master
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Make tag and release
if: ${{ github.ref == 'refs/heads/master'}} # only runs if the push is to master
env:
GH_TOKEN: ${{ github.token}}
run: |
export VERSION_NEW="$(poetry version -s)"
export NEW_TAG=v$VERSION_NEW
git tag $NEW_TAG -m "$NEW_TAG release"
git push origin $NEW_TAG
# we want to include the changelog since the last release
# First, we use gh release and some regex to get the latest tag
export LATEST_TAG=$(gh release list | sed -rn 's/.*Latest\s*(\S+).*/\1/p')
# Next, we use some more regex to select
# the section of the changelog between the new and latest versions:
git diff --output-indicator-new=\| $LATEST_TAG $NEW_TAG changelog.txt | sed -rn "/^\|.*$VERSION_NEW/,/^[^|]/{s/\|//p}" | sed -n "2,\$p" > /tmp/changelog_$NEW_TAG.md
gh release create $NEW_TAG --notes-file /tmp/changelog_$NEW_TAG.md --generate-notes