Deploying using Github Actions

This example provides a simple Github Action configuration file to get you started on deploying with scw_serverless in your CI/CD pipelines.

To do so, simply copy the deploy.yml file in .github/workflows.

Then set the following variables on your Github Action Secrets:

  • SCW_SECRET_KEY: your user secret key

  • SCW_ACCESS_KEY: your user access key

  • SCW_DEFAULT_PROJECT_ID: your default project ID

This example will automatically run scw-serverless deploy in the project root to deploy your function on each git tag.

You can specify another deployment region (fr-par is the by-default deployment region) using for example:

scw-serverless deploy --region pl-waw app.py

Source

# This workflow will install Python dependencies and deploy to scaleway's serverless functions.

name: Deploy to scaleway's serverless functions

on:
  push:
    - tags:
      - '*'

permissions:
  contents: read

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    - name: Set up Python 3.10
      uses: actions/setup-python@v3
      with:
        python-version: "3.10"
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
    - name: Deploy to scaleway's serverless functions
      run: |
        scw-serverless deploy app.py
      env:
        SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }}
        SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }}
        SCW_DEFAULT_PROJECT_ID: ${{ secrets.SCW_DEFAULT_PROJECT_ID }}