Merge pull request #37 from developmentseed/dependabot/pip/titiler-6a… #56
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: CI | |
on: | |
push: | |
paths: | |
- 'Dockerfile' | |
- 'requirements.txt' | |
- 'scripts/create-lambda-layer.sh' | |
- 'scripts/deploy.py' | |
- '.github/workflows/ci.yml' | |
env: | |
PYTHON_VERSION: '3.11' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
uses: docker/build-push-action@v3 | |
with: | |
platforms: linux/amd64 | |
context: . | |
load: true | |
push: false | |
tags: devseed/titiler-layer:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
PYTHON_VERSION=${{ env.PYTHON_VERSION }} | |
- name: Create Package | |
run: | | |
docker run \ | |
--platform=linux/amd64 \ | |
--entrypoint bash \ | |
-v ${{ github.workspace }}:/local \ | |
--rm devseed/titiler-layer:latest \ | |
/local/scripts/create-lambda-layer.sh | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Set module version | |
id: titiler_version | |
run: | | |
echo version=$(docker run --platform=linux/amd64 --entrypoint '' --rm devseed/titiler-layer:latest python -c'import titiler.core; print(titiler.core.__version__)') >> $GITHUB_OUTPUT | |
- name: Print Version | |
run: | | |
echo "${{ steps.titiler_version.outputs.version }}" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install boto3 click | |
- name: Deploy layers | |
if: github.ref == 'refs/heads/main' | |
run: python scripts/deploy.py ${{ env.PYTHON_VERSION }} ${{ steps.titiler_version.outputs.version }} |