-
Notifications
You must be signed in to change notification settings - Fork 35
62 lines (53 loc) · 1.95 KB
/
build_and_publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Build and publish
on: [push, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get the master branch (for checks)
uses: actions/checkout@v3
with:
ref: 'refs/heads/master'
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Cache pip
uses: actions/cache@v3
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: Check if version is updated
run: |
git checkout origin/master
export master_version=$(poetry version)
git checkout $GITHUB_REF_NAME
if [ "$master_version" = "$(poetry version)" ]
then
echo Version number is the same as existing release. Please update the version number!
# exit 1
fi
- name: Build NuRadioMC # let's always build - maybe this will occasionally catch errors
run: poetry build
- 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 }}