-
Notifications
You must be signed in to change notification settings - Fork 105
84 lines (69 loc) · 2.21 KB
/
nightly-publish.yml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: NightlyPublish
on:
workflow_dispatch: # Allow manual triggers
schedule:
# Runs every day at 3:07am UTC.
- cron: '7 3 * * *'
jobs:
check:
name: Check files
# Prevent Publish from running on forks.
if: github.repository == 'tensorflow/similarity'
outputs:
run_job: ${{ steps.check_files.outputs.run_job }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
ref: 'development'
- name: check modified files
id: check_files
run: |
echo "=============== list modified files ==============="
git diff --name-only HEAD^ HEAD
echo "========== check paths of modified files =========="
git diff --name-only HEAD^ HEAD > files.txt
while IFS= read -r file
do
echo $file
if [[ $file = tensorflow_similarity/* && $file != tensorflow_similarity/__init__.py ]]; then
echo "This modified file is under the 'tensorflow_similarity' folder."
echo "::set-output name=run_job::true"
break
else
echo "::set-output name=run_job::false"
fi
done < files.txt
publish:
name: Publish nightly
needs: check
# Prevent Publish from running on forks.
if: |
github.repository == 'tensorflow/similarity' &&
needs.check.outputs.run_job == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: 'development'
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install package
run: |
pip install ".[tensorflow,dev]"
- name: Increment dev version
run: |
# Increments the dev version and pushes the changes to development.
python scripts/increment_version.py
- name: Build package
run: |
python setup.py sdist bdist_wheel --project_name tfsim-nightly
- name: Publish package
run: |
twine upload -u ${{ secrets.PYPI_NIGHTLY_USERNAME }} -p ${{ secrets.PYPI_NIGHTLY_TOKEN }} dist/* --verbose