Skip to content

Commit f250517

Browse files
authored
Updates the GHA deploy workflow to build the universal wheel and upload to PyPi (on a tag event only) (crossbario#1615)
1 parent a51c2f5 commit f250517

File tree

1 file changed

+29
-54
lines changed

1 file changed

+29
-54
lines changed

.github/workflows/deploy.yml

Lines changed: 29 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -10,70 +10,45 @@ on:
1010
- master
1111
types:
1212
- completed
13+
push:
14+
tags:
15+
- 'v[0-9]+.[0-9]+.[0-9]+'
1316

1417
jobs:
1518

16-
deploy:
17-
if: github.ref == 'refs/heads/master'
18-
19-
runs-on: ubuntu-20.04
20-
21-
# https://github.blog/changelog/2020-12-15-github-actions-environments-environment-protection-rules-and-environment-secrets-beta/
22-
# https://docs.github.com/en/free-pro-team@latest/actions/reference/environments
23-
environment: deploy_aws
24-
25-
env:
26-
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
27-
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
28-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
29-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
30-
WAMP_PRIVATE_KEY: ${{ secrets.WAMP_PRIVATE_KEY }}
31-
19+
build_wheels:
20+
name: Build & Upload
21+
runs-on: ubuntu-22.04
3222
steps:
33-
- uses: actions/checkout@v2
34-
35-
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
36-
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
37-
- name: Set environment
38-
run: |
39-
echo AUTOBAHN_BUILD_DATE=`date -u +"%Y-%m-%d"` >> $GITHUB_ENV
40-
echo AUTOBAHN_BUILD_ID=$(date --utc +%Y%m%d)-$(git rev-parse --short ${GITHUB_SHA}) >> $GITHUB_ENV
41-
echo AUTOBAHN_VCS_REF=`git rev-parse --short ${GITHUB_SHA}` >> $GITHUB_ENV
42-
echo AUTOBAHN_VERSION=$(grep -E '^(__version__)' ./autobahn/_version.py | cut -d ' ' -f3 | sed -e 's|[u"'\'']||g') >> $GITHUB_ENV
43-
44-
- name: Print environment
45-
run: |
46-
echo ""
47-
echo "Build environment configured:"
48-
echo ""
49-
echo " AUTOBAHN_BUILD_DATE = ${AUTOBAHN_BUILD_DATE}"
50-
echo " AUTOBAHN_BUILD_ID = ${AUTOBAHN_BUILD_ID}"
51-
echo " AUTOBAHN_VCS_REF = ${AUTOBAHN_VCS_REF}"
52-
echo " AUTOBAHN_VERSION = ${AUTOBAHN_VERSION}"
53-
echo ""
54-
echo "Wheels (publish):"
55-
echo " AWS_DEFAULT_REGION = ${AWS_DEFAULT_REGION}"
56-
echo " AWS_S3_BUCKET_NAME = ${AWS_S3_BUCKET_NAME}"
57-
echo ""
58-
59-
- name: Install OS package dependencies
60-
run: |
61-
sudo apt update
62-
sudo apt install build-essential libssl-dev libffi-dev libunwind-dev \
63-
libreadline-dev zlib1g-dev libbz2-dev libsqlite3-dev libncurses5-dev \
64-
libsnappy-dev libgirepository1.0-dev
23+
- uses: actions/checkout@v3
6524

6625
- name: Set up Python 3.x
67-
uses: actions/setup-python@v2
26+
uses: actions/setup-python@v4
6827
with:
6928
python-version: '3.x'
7029
architecture: 'x64'
7130

72-
- name: Install Python package dependencies
31+
- name: Upgrade pip
7332
run: |
74-
python -m pip install --upgrade pip
75-
pip install -r requirements-dev.txt
33+
python3 -m pip install --upgrade pip
34+
35+
- name: Install build & wheel
36+
run:
37+
pip3 install --upgrade build wheel
7638

77-
- name: Deploy (build, package and upload)
39+
- name: Build wheel & sdist
7840
run: |
79-
./deploy.sh
41+
python3 -m build --wheel --sdist
42+
43+
- uses: actions/upload-artifact@v3
44+
with:
45+
name: built-packages
46+
path: |
47+
./dist/*.whl
48+
./dist/*.tar.gz
49+
50+
- name: Publish to Pypi
51+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
52+
uses: pypa/gh-action-pypi-publish@release/v1
53+
with:
54+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)