diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cfd5f9d4..9ecbb14d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,10 +15,12 @@ jobs: command: poetry run pylint prophecies test-backend: - uses: ./.github/workflows/python_task.yml - with: - python-version: '["3.9", "3.10"]' - command: make test-back + runs-on: ubuntu-latest + steps: + - uses: ./.github/workflows/python_task.yml + with: + python-version: '["3.9", "3.10"]' + command: make test-back test-frontend: uses: ./.github/workflows/node_task.yml @@ -26,6 +28,37 @@ jobs: node-version: '["16.x", "18.x"]' command: make test-front + build: + runs-on: ubuntu-latest + needs: [lint-backend, test-backend, test-frontend] + steps: + - name: Save OpenAPI schema + uses: ./.github/workflows/python_task.yml + with: + python-version: '["3.9"]' + command: poetry run python manage.py spectacular --file ./openapi-$(poetry version --short)-${GITHUB_SHA}.yml + + - name: Upload OpenAPI schema to artifacts + uses: actions/upload-artifact@v4 + with: + name: openapi-schemas + path: | + ./openapi-*.yml + + release: + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + needs: [build] + steps: + - name: Prepare release name + id: prep + run: echo "RELEASE_NAME=$(echo ${GITHUB_REF#refs/tags/v})" >> $GITHUB_ENV + + - name: Download all OpenAPI schema artifacts + uses: actions/download-artifact@v4 + with: + name: openapi-schemas + docker-publish: needs: [lint-backend, test-backend, test-frontend] if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v')