1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- name : Release
15+ name : Release Candidate
1616
1717on :
1818 # Only run the workflow when a PR is updated or when a developer explicitly requests
4949 run : |
5050 python -m pip install --upgrade pip
5151 pip install -r requirements.txt
52- pip install wheel
52+ pip install setuptools wheel
5353
5454 - name : Run unit tests
5555 run : pytest
6060 FIREBASE_SERVICE_ACCT_KEY : ${{ secrets.FIREBASE_SERVICE_ACCT_KEY }}
6161 FIREBASE_API_KEY : ${{ secrets.FIREBASE_API_KEY }}
6262
63+ # Build the Python Wheel and the source distribution.
6364 - name : Package release artifacts
64- run : python setup.py bdist_wheel bdist_egg
65+ run : python setup.py bdist_wheel sdist
6566
6667 # Attach the packaged artifacts to the workflow output. These can be manually
6768 # downloaded for later inspection if necessary.
@@ -71,24 +72,48 @@ jobs:
7172 name : dist
7273 path : dist
7374
75+ publish_release :
76+ needs : stage_release
77+
7478 # Check whether the release should be published. We publish only when the trigger PR is
7579 # 1. merged
7680 # 2. to the master branch
7781 # 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+
78109 - 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 ')
82110 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
86112
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.
90116 - name : Create release tag
91- if : success() && env.FIREBASE_PUBLISH
92117 uses : fleskesvor/create-release@1a72e235c178bf2ae6c51a8ae36febc24568c5fe
93118 env :
94119 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -100,12 +125,11 @@ jobs:
100125 prerelease : false
101126
102127 - name : Publish to Pypi
103- if : success() && env.FIREBASE_PUBLISH
104128 run : echo Publishing to Pypi
105129
106130 # Post to Twitter if explicitly opted-in by adding the label 'release:tweet'.
107131 - name : Post to Twitter
108- if : success() && env.FIREBASE_PUBLISH &&
132+ if : success() &&
109133 contains(github.event.pull_request.labels.*.name, 'release:tweet')
110134 run : echo Posting Tweet
111135 continue-on-error : true
0 commit comments