12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
- name : Release
15
+ name : Release Candidate
16
16
17
17
on :
18
18
# Only run the workflow when a PR is updated or when a developer explicitly requests
49
49
run : |
50
50
python -m pip install --upgrade pip
51
51
pip install -r requirements.txt
52
- pip install wheel
52
+ pip install setuptools wheel
53
53
54
54
- name : Run unit tests
55
55
run : pytest
60
60
FIREBASE_SERVICE_ACCT_KEY : ${{ secrets.FIREBASE_SERVICE_ACCT_KEY }}
61
61
FIREBASE_API_KEY : ${{ secrets.FIREBASE_API_KEY }}
62
62
63
+ # Build the Python Wheel and the source distribution.
63
64
- name : Package release artifacts
64
- run : python setup.py bdist_wheel bdist_egg
65
+ run : python setup.py bdist_wheel sdist
65
66
66
67
# Attach the packaged artifacts to the workflow output. These can be manually
67
68
# downloaded for later inspection if necessary.
@@ -71,24 +72,48 @@ jobs:
71
72
name : dist
72
73
path : dist
73
74
75
+ publish_release :
76
+ needs : stage_release
77
+
74
78
# Check whether the release should be published. We publish only when the trigger PR is
75
79
# 1. merged
76
80
# 2. to the master branch
77
81
# 3. with the title prefix '[chore] Release '.
82
+ if : github.event.pull_request.merged &&
83
+ github.ref == 'master' &&
84
+ startsWith(github.event.pull_request.title, '[chore] Release ')
85
+
86
+ runs-on : ubuntu-latest
87
+
88
+ steps :
89
+ - name : Checkout source for publish
90
+ uses : actions/checkout@v2
91
+
92
+ # Download the artifacts created by the stage_release job.
93
+ - name : Download release candidates
94
+ uses : actions/download-artifact@v1
95
+ with :
96
+ name : dist
97
+
98
+ # Python is needed to run Twine and some of the preflight checks.
99
+ - name : Set up Python
100
+ uses : actions/setup-python@v1
101
+ with :
102
+ python-version : 3.6
103
+
104
+ - name : Install dependencies
105
+ run : |
106
+ python -m pip install --upgrade pip
107
+ pip install twine
108
+
78
109
- name : Publish preflight check
79
- if : success() && github.event.pull_request.merged &&
80
- github.ref == 'master' &&
81
- startsWith(github.event.pull_request.title, '[chore] Release ')
82
110
id : preflight
83
- run : |
84
- ./.github/scripts/publish_preflight_check.sh
85
- echo ::set-env name=FIREBASE_PUBLISH::true
111
+ run : ./.github/scripts/publish_preflight_check.sh
86
112
87
- # Tag the release if not executing in the dryrun mode. We pull this action froma
88
- # custom fork of a contributor until https://github.com/actions/create-release/pull/32
89
- # is merged. Also note that v1 of this action does not support the "body" parameter.
113
+ # We pull this action from a custom fork of a contributor until
114
+ # https://github.com/actions/create-release/pull/32 is merged. Also note that v1 of
115
+ # this action does not support the "body" parameter.
90
116
- name : Create release tag
91
- if : success() && env.FIREBASE_PUBLISH
92
117
uses : fleskesvor/create-release@1a72e235c178bf2ae6c51a8ae36febc24568c5fe
93
118
env :
94
119
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -100,12 +125,11 @@ jobs:
100
125
prerelease : false
101
126
102
127
- name : Publish to Pypi
103
- if : success() && env.FIREBASE_PUBLISH
104
128
run : echo Publishing to Pypi
105
129
106
130
# Post to Twitter if explicitly opted-in by adding the label 'release:tweet'.
107
131
- name : Post to Twitter
108
- if : success() && env.FIREBASE_PUBLISH &&
132
+ if : success() &&
109
133
contains(github.event.pull_request.labels.*.name, 'release:tweet')
110
134
run : echo Posting Tweet
111
135
continue-on-error : true
0 commit comments