Skip to content

v0.3.2 - AlphaSquared Integration #2

v0.3.2 - AlphaSquared Integration

v0.3.2 - AlphaSquared Integration #2

# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package and Build Lambda Layer
on:
release:
types: [created]
workflow_dispatch:
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Wait for PyPI to update
run: |
echo "Waiting for PyPI to update..."
sleep 300 # Wait for 5 minutes
build-lambda-layer:
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install virtualenv
- name: Create Lambda Layer
run: |
virtualenv venv
source venv/bin/activate
mkdir python
PACKAGE_VERSION=$(python setup.py --version)
echo "coinbase-advancedtrade-python==$PACKAGE_VERSION" > requirements.txt
docker run --rm -v "$PWD":/var/task public.ecr.aws/sam/build-python3.9:latest /bin/sh -c "pip install --platform manylinux2014_x86_64 --implementation cp --python 3.9 --only-binary=:all: --upgrade -r requirements.txt -t python"
zip -r layer-python3.9-x86_64.zip python
- name: Upload Layer to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./layer-python3.9-x86_64.zip
asset_name: layer-python3.9-x86_64.zip
asset_content_type: application/zip