Skip to content

Stop Scaleway

Stop Scaleway #2

Workflow file for this run

name: Stop Scaleway
on:
workflow_dispatch: # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
schedule: # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
- cron: "12 21 * * *"
jobs:
down:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get Scaleway CLI image
id: pull
run: docker pull scaleway/cli:2.28
- name: Get Container ID
id: list
run: |
docker run -i --rm \
-e SCW_ACCESS_KEY=${{ secrets.SCALEWAY_ACCESS_KEY }} \
-e SCW_SECRET_KEY=${{ secrets.SCALEWAY_SECRET_KEY }} \
-e SCW_DEFAULT_ORGANIZATION_ID=${{ secrets.SCALEWAY_ORGANIZATION_ID }} \
scaleway/cli:latest container container list name=${{ secrets.CONTAINER_NAME }} --output json
- name: Get CONTAINER_ID env var
run: echo "CONTAINER_ID=$(cat "${GITHUB_WORKSPACE}/scw.output" | jq -r '.[0].id')" >> $GITHUB_ENV
- name: 0 instances
id: scale-down
run: |
docker run -i --rm \
-e SCW_ACCESS_KEY=${{ secrets.SCALEWAY_ACCESS_KEY }} \
-e SCW_SECRET_KEY=${{ secrets.SCALEWAY_SECRET_KEY }} \
-e SCW_DEFAULT_ORGANIZATION_ID=${{ secrets.SCALEWAY_ORGANIZATION_ID }} \
scaleway/cli:latest container container update ${{ env.CONTAINER_ID }} min-scale=0