Templating
: Copy Course with all Core Data
#101
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate and Release API Spec | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
detect-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
core-changed: ${{ steps.changes.outputs.core }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
core: | |
- 'servers/core/**' | |
generate-api-spec: | |
runs-on: ubuntu-latest | |
needs: detect-changes | |
if: | | |
needs.detect-changes.outputs.core-changed == 'true' | |
strategy: | |
matrix: | |
directory: | |
- ${{ needs.detect-changes.outputs.core-changed == 'true' && 'core' || '' }} | |
exclude: | |
- directory: "" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Install swag | |
run: | | |
go install github.com/swaggo/swag/cmd/swag@latest | |
echo "${HOME}/go/bin" >> $GITHUB_PATH | |
- name: Generate API spec for ${{ matrix.directory }} | |
run: | | |
cd servers/${{ matrix.directory }} | |
swag init --output docs/api --parseDependency --parseInternal | |
- name: Upload API spec artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: api-spec-${{ matrix.directory }} | |
path: servers/${{ matrix.directory }}/docs/api/ |