@@ -10,79 +10,46 @@ jobs:
10
10
runs-on : ubuntu-latest
11
11
steps :
12
12
- name : fail on fork
13
- if : github.repository_owner ! = 'cmu-delphi'
13
+ if : github.repository_owner = = 'cmu-delphi'
14
14
run : exit 1
15
15
16
- create_release :
16
+ client_changed :
17
17
needs : correct_repository
18
18
runs-on : ubuntu-latest
19
19
steps :
20
20
- name : Check out code
21
21
uses : actions/checkout@v2
22
22
with :
23
- ssh-key : ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_SSH }}
24
- - name : Set up Python 3.8
25
- uses : actions/setup-python@v2
26
- with :
27
- python-version : 3.8
28
- - name : Extract version
29
- id : extract_version
30
- run : |
31
- python -m pip install bump2version
32
- echo -n "::set-output name=version::"
33
- bump2version --dry-run --list patch | grep ^current_version | sed -r s,"^.*=",,
34
- - name : Create Release
35
- id : create_release
36
- uses : release-drafter/release-drafter@v5
37
- env :
38
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
23
+ fetch-depth : 2
24
+ - name : Get Python client file changes
25
+ id : changed-py
26
+ uses : dorny/paths-filter@v3
39
27
with :
40
- version : ${{ steps.extract_version.outputs.version }}
41
- publish : true
28
+ # when base and ref are the same, changes are detected against the most recent commit before the push.
29
+ # see https://github.com/dorny/paths-filter#usage for details.
30
+ base : ' main'
31
+ ref : ' main'
32
+ filters : |
33
+ python_client_changed:
34
+ - src/client/delphi_epidata.py
35
+ - src/client/packaging/pypi/**
42
36
outputs :
43
- version : ${{ steps.extract_version.outputs.version }}
44
- upload_url : ${{ steps.create_release.outputs.upload_url }}
45
- tag_name : ${{ steps.create_release.outputs.tag_name }}
37
+ python_client_changed : ${{ steps.changed-py.outputs.python_client_changed }}
38
+
39
+ create_release :
40
+ needs : correct_repository
41
+ runs-on : ubuntu-latest
42
+ steps :
43
+ - name : Check out code
44
+ uses : actions/checkout@v2
46
45
47
46
release_python_client :
48
- needs : create_release
47
+ needs : [client_changed, create_release]
48
+ if : needs.client_changed.outputs.python_client_changed == 'true'
49
49
runs-on : ubuntu-latest
50
50
steps :
51
51
- name : Check out code
52
52
uses : actions/checkout@v2
53
- - name : Set up Python 3.8
54
- uses : actions/setup-python@v2
55
- with :
56
- python-version : 3.8
57
- - name : Install build dependencies
58
- run : |
59
- python -m pip install --upgrade pip
60
- pip install build wheel twine
61
- - name : Prepare package
62
- run : |
63
- cp src/client/*.py src/client/packaging/pypi/delphi_epidata/
64
- - name : Create release
65
- working-directory : src/client/packaging/pypi
66
- run : |
67
- python -m build --sdist --wheel
68
- - uses : actions/upload-artifact@v2
69
- with :
70
- name : delphi_epidata_py
71
- path : src/client/packaging/pypi/dist/*.tar.gz
72
- - name : Upload Release Asset
73
-
74
- with :
75
- files : " src/client/packaging/pypi/dist/*.tar.gz"
76
- repo-token : ${{ secrets.GITHUB_TOKEN }}
77
- release-tag : ${{ needs.create_release.outputs.tag_name }}
78
- - name : Publish a Python distribution to PyPI
79
- uses : pypa/gh-action-pypi-publish@release/v1
80
- with :
81
- user : __token__
82
- password : ${{ secrets.DELPHI_PYPI_PROD_TOKEN }}
83
- packages-dir : src/client/packaging/pypi/dist/
84
- skip-existing : true
85
- # repository_url: https://test.pypi.org/legacy/
86
53
87
54
release_js_client :
88
55
needs : create_release
93
60
steps :
94
61
- name : Check out code
95
62
uses : actions/checkout@v2
96
- - uses : actions/setup-node@v2
97
- with :
98
- node-version : ' 16.x'
99
- - name : Cache Node.js modules
100
- uses : actions/cache@v2
101
- with :
102
- path : ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
103
- key : ${{ runner.OS }}-node2-${{ hashFiles('**/package-lock.json') }}
104
- restore-keys : |
105
- ${{ runner.OS }}-node2-
106
- - run : npm ci
107
- - run : npm test
108
- - run : npm pack
109
- - name : Rename to a different name
110
- run : for f in *.tgz; do mv "$f" "$(echo "$f" | sed s/delphi_epidata-/delphi_epidata_js-/)"; done
111
- - uses : actions/upload-artifact@v2
112
- with :
113
- name : delphi_epidata_js
114
- path : src/client/packaging/npm/*.tgz
115
- - name : Upload Release Asset
116
-
117
- with :
118
- files : " src/client/packaging/npm/*.tgz"
119
- repo-token : ${{ secrets.GITHUB_TOKEN }}
120
- release-tag : ${{ needs.create_release.outputs.tag_name }}
121
- - name : Publish to NPM
122
- uses : JS-DevTools/npm-publish@v1
123
- with :
124
- token : ${{ secrets.DELPHI_NPM_TOKEN }}
125
- package : src/client/packaging/npm/package.json
126
- access : public
127
- check-version : true
128
63
129
64
sync_dev :
130
65
needs : correct_repository
146
81
commit-message : " chore: sync main-dev"
147
82
base : dev
148
83
title : " chore: sync main->dev"
149
- labels : chore
150
- reviewers : melange396
151
- assignees : melange396
152
84
body : |
153
85
Syncing Main->Dev.
0 commit comments