Skip to content

Commit

Permalink
ci: apiclient dispatch (#44)
Browse files Browse the repository at this point in the history
* ci: apiclient dispatch

* fix: deprecated set-output
  • Loading branch information
adrrf authored Dec 30, 2024
1 parent 95af88c commit 6ad0316
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/openapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: 🔀OpenAPI - Axios Client

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout ⬇️
uses: actions/checkout@v4.2.2
with:
show-progress: false

- name: Cache Dependencies 📦
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Copy Config File 📄
run: cp config.yaml.example config.yaml

- name: Build 🛠️
run: cargo build --verbose

- name: Generate OpenAPI Spec 📜
run: cargo run -- merge --url 'http://0.0.0.0:8080' --specs './docs/' --output './static/openapi.html'

- name: Check if the schema was modified 🧐
id: diff
run: |
diff=$(git status -su | grep static/openapi.yaml | wc -l)
echo "diff=$diff" >> $GITHUB_ENV
- name: Commit changes 📤
if: ${{ env.diff != '0' && github.event_name == 'push' }}
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git add .
git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update openapi schema 🔄" && git push)
- name: Dispatch event to Axios Client 🚀
uses: convictional/trigger-workflow-and-wait@v1.6.5
with:
owner: fis2425
repo: apiclient
github_token: ${{ secrets.DISPATCH_TOKEN }}
workflow_file_name: generation.yml
ref: main
wait_workflow: false

0 comments on commit 6ad0316

Please sign in to comment.