deploy-wheels #86
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deploy-wheels | |
on: | |
# Trigger this workflow when the "main" workflow has completed successfully | |
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#workflow_run | |
workflow_run: | |
workflows: | |
- main | |
branches: | |
- master | |
types: | |
- completed | |
jobs: | |
deploy: | |
# wheels are only built and published (to our S3 bucket) when merging to master (not a yet unmerged PR!) | |
if: github.ref == 'refs/heads/master' | |
# runs-on: ubuntu-20.04 # means github.com | |
runs-on: [self-hosted, linux, X64] # means matterhorn | |
# https://github.blog/changelog/2020-12-15-github-actions-environments-environment-protection-rules-and-environment-secrets-beta/ | |
# https://docs.github.com/en/free-pro-team@latest/actions/reference/environments | |
environment: deploy_aws | |
env: | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
WAMP_PRIVATE_KEY: ${{ secrets.WAMP_PRIVATE_KEY }} | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable | |
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path | |
- name: Set environment | |
run: | | |
echo CROSSBAR_BUILD_DATE=`date -u +"%Y-%m-%d"` >> $GITHUB_ENV | |
echo CROSSBAR_VCS_REF=`git rev-parse --short ${GITHUB_SHA}` >> $GITHUB_ENV | |
echo CROSSBAR_BUILD_ID=$(date --utc +%Y%m%d)-$(git rev-parse --short ${GITHUB_SHA}) >> $GITHUB_ENV | |
echo CROSSBAR_VERSION=$(grep -E '^(__version__)' ./crossbar/_version.py | cut -d ' ' -f3 | sed -e 's|[u"'\'']||g') >> $GITHUB_ENV | |
echo WAMP_PRIVATE_KEY=${WAMP_PRIVATE_KEY} >> $GITHUB_ENV | |
echo ACCESS_TOKEN=${ACCESS_TOKEN} >> $GITHUB_ENV | |
- name: Print environment | |
run: | | |
echo "" | |
echo "Build environment configured:" | |
echo "" | |
echo " CROSSBAR_BUILD_DATE = ${CROSSBAR_BUILD_DATE}" | |
echo " CROSSBAR_BUILD_ID = ${CROSSBAR_BUILD_ID}" | |
echo " CROSSBAR_VCS_REF = ${CROSSBAR_VCS_REF}" | |
echo " CROSSBAR_VERSION = ${CROSSBAR_VERSION}" | |
echo "" | |
echo "Wheels (publish):" | |
echo " AWS_DEFAULT_REGION = ${AWS_DEFAULT_REGION}" | |
echo " AWS_S3_BUCKET_NAME = ${AWS_S3_BUCKET_NAME}" | |
echo "" | |
# must be skipped on self-hosted build slaves (eg matterhorn) | |
# | |
# - name: Install OS package dependencies | |
# run: | | |
# sudo apt update | |
# sudo apt install build-essential libssl-dev libffi-dev libunwind-dev \ | |
# libreadline-dev zlib1g-dev libbz2-dev libsqlite3-dev libncurses5-dev \ | |
# libsnappy-dev | |
# FIXME: must use python <3.10, see https://github.com/crossbario/crossbar/issues/1965 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.11' | |
architecture: 'x64' | |
- name: Install Python package dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements-dev.txt | |
- name: Build and deploy wheels | |
run: | | |
./deploy-wheels.sh | |
- name: Trigger Binaries CD pipeline | |
run: | | |
curl -v -X POST -u "${ACCESS_TOKEN}" \ | |
-H "Accept: application/vnd.github.everest-preview+json" \ | |
-H "Content-Type: application/json" \ | |
--data '{"event_type":"build", "client_payload": {"CROSSBAR_BUILD_DATE": "${CROSSBAR_BUILD_DATE}", "CROSSBAR_BUILD_ID": "${CROSSBAR_BUILD_ID}", "CROSSBAR_VCS_REF": "${CROSSBAR_VCS_REF}", "CROSSBAR_VERSION": "${CROSSBAR_VERSION}"}}' \ | |
https://api.github.com/repos/crossbario/crossbar-binaries/dispatches |