mirror of
https://github.com/remnawave/backend.git
synced 2026-08-03 22:28:14 +00:00
99 lines
2.8 KiB
YAML
99 lines
2.8 KiB
YAML
name: Build&Push OpenAPI Specs
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
send-tg-msg:
|
|
name: Send TG message
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Send Telegram message
|
|
uses: proDreams/actions-telegram-notifier@main
|
|
with:
|
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}
|
|
thread_id: ${{ secrets.TELEGRAM_TOPIC_ID }}
|
|
status: pending
|
|
notify_fields: 'repo_with_tag,commit,workflow'
|
|
title: 'Pushing OpenAPI specs to R2...'
|
|
|
|
push-openapi:
|
|
name: Push OpenAPI specs to R2
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Generate OpenAPI JSON
|
|
env:
|
|
DATABASE_URL: 'postgresql://postgres:postgres@remnawave-db:5432/postgres'
|
|
APP_SECRET: 'mock'
|
|
FRONT_END_DOMAIN: 'mock'
|
|
METRICS_USER: 'mock'
|
|
METRICS_PASS: 'mock'
|
|
SUB_PUBLIC_DOMAIN: 'mock'
|
|
REDIS_HOST: 'localhost'
|
|
REDIS_PORT: '6379'
|
|
INSTANCE_TYPE: 'api'
|
|
run: npm run generate:openapi
|
|
|
|
- uses: ryand56/r2-upload-action@latest
|
|
with:
|
|
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
|
|
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
|
|
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
|
r2-bucket: ${{ secrets.R2_BUCKET }}
|
|
source-dir: ./openapi.json
|
|
destination-dir: ./docs/
|
|
|
|
send-finish-tg-msg:
|
|
name: Send TG message
|
|
needs: [push-openapi]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Send Telegram message
|
|
uses: proDreams/actions-telegram-notifier@main
|
|
with:
|
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}
|
|
thread_id: ${{ secrets.TELEGRAM_TOPIC_ID }}
|
|
status: ${{ job.status }}
|
|
notify_fields: 'repo_with_tag,commit,workflow'
|
|
title: 'OpenAPI specs pushed to R2.'
|
|
|
|
notify-on-error:
|
|
runs-on: ubuntu-latest
|
|
needs: [push-openapi]
|
|
if: failure()
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Send error notification
|
|
uses: proDreams/actions-telegram-notifier@main
|
|
with:
|
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}
|
|
thread_id: ${{ secrets.TELEGRAM_TOPIC_ID }}
|
|
status: failure
|
|
notify_fields: 'repo_with_tag,commit,workflow'
|
|
title: 'OpenAPI specs push failed.'
|