Skip to content

Commit

Permalink
Add OpenAPI Specification to Release Assets
Browse files Browse the repository at this point in the history
  • Loading branch information
kiblik committed Nov 27, 2023
1 parent 96b12eb commit 8b99500
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/workflows/fetch-oas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Fetch OpenAPI Specifications

on:
workflow_call:

jobs:
oas_fetch:
name: etch OpenAPI Specifications
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

# load docker images from build jobs
- name: Load images from artifacts
uses: actions/download-artifact@v3

- name: Load docker images
run: |-
docker load -i nginx/nginx-alpine_img
docker load -i django/django-alpine_img
docker images
- name: Start Dojo
run: docker-compose --profile postgres-redis --env-file ./docker/environments/postgres-redis.env up --no-deps -d postgres nginx uwsgi
env:
DJANGO_VERSION: alpine
NGINX_VERSION: alpine

- name: Download OpenAPI Specifications
run: |-
wget 'http://localhost:8080/api/v2/oa3/schema/?format=yaml' -O oas.yaml
wget 'http://localhost:8080/api/v2/oa3/schema/?format=json' -O oas.json
- name: Logs
if: always()
run: docker-compose --profile postgres-redis --env-file ./docker/environments/postgres-redis.env logs --tail="2500"

- name: Shutdown
if: always()
run: docker-compose --profile postgres-redis --env-file ./docker/environments/postgres-redis.env down
36 changes: 35 additions & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,45 @@ on:
- dev

jobs:
build-docker-containers:
uses: ./.github/workflows/build-docker-images-for-testing.yml
secrets: inherit

oas-fetch:
needs: build-docker-containers
uses: ./.github/workflows/fetch-oas.yml
secrets: inherit

update_release_draft:
needs: oas-fetch
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5.25.0
- name: Create Release
id: create_release
uses: release-drafter/release-drafter@v5.25.0
with:
version: ${{github.event.inputs.version}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Release Asset - OpenAPI Specification - YAML
id: upload-release-asset-yaml
uses: sekwah41/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./oas.yaml
asset_name: oas.yaml
asset_content_type: application/vnd.oai.openapi

- name: Upload Release Asset - OpenAPI Specification - JSON
id: upload-release-asset-json
uses: sekwah41/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./oas.json
asset_name: oas.json
asset_content_type: application/json

0 comments on commit 8b99500

Please sign in to comment.