Skip to content

API

API #283

Workflow file for this run

name: API
on:
push:
branches:
- master
schedule:
- cron: '0 21 * * MON'
workflow_dispatch:
inputs:
providers:
description: 'Provider IDs (comma-separated)'
required: false
default: 'all'
jobs:
push_to_api:
name: Push to API
runs-on: ubuntu-latest
env:
API_PROVIDERS: ${{ secrets.API_PROVIDERS }}
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_CHAT: ${{ secrets.TELEGRAM_CHAT }}
steps:
- name: Check out current
uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Get changed files
id: changed_files
if: github.event_name == 'push'
uses: tj-actions/changed-files@v41
with:
files: |
providers/*
- name: Update providers (push)
id: update_providers_push
if: github.event_name == 'push'
env:
CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }}
run: |
if ! ci/update-providers.sh; then
echo "Skipping deploy"
echo "skip_deploy=1" >> $GITHUB_OUTPUT
exit 0
fi
- name: Update providers (Cron)
if: github.event_name == 'schedule'
run: |
ci/update-providers.sh "$API_PROVIDERS"
- name: Update providers (manual)
if: github.event_name == 'workflow_dispatch'
env:
API_PROVIDERS_MANUAL: ${{ github.event.inputs.providers }}
run: |
if [[ -n "$API_PROVIDERS_MANUAL" ]]; then
API_PROVIDERS="$API_PROVIDERS_MANUAL"
fi
ci/update-providers.sh "$API_PROVIDERS"
- name: Deploy
if: ${{ !steps.update_providers_push.outputs.skip_deploy }}
uses: tagus/[email protected]
with:
changes: gen
repository: [email protected]:passepartoutvpn/api.git
ssh_key: ${{ secrets.API_DEPLOY_KEY }}
name: Passepartout API
email: [email protected]