Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c1348b3
Create docs.yml
janetjotw Mar 10, 2025
a716060
Merge pull request #1 from janetjotw/janetjotw-patch-1
janetjotw Mar 10, 2025
c33acbe
Merge pull request #2 from janetjotw/create-cicd-automation
janetjotw Mar 10, 2025
348e0b5
Update api-v1.yaml
janetjotw Mar 10, 2025
e94b8db
Update docs.yml
janetjotw Mar 10, 2025
eed76a0
Update docs.yml
janetjotw Mar 10, 2025
226f4c5
Update docs.yml
janetjotw Mar 10, 2025
10df4ed
Update api-v1.yaml
janetjotw Mar 10, 2025
09fc280
Update api-v1.yaml
janetjotw Mar 11, 2025
de67358
Update docs.yml
janetjotw Mar 11, 2025
0016586
Create index.html
janetjotw Mar 11, 2025
c29dd25
Update api-v1.yaml
janetjotw Mar 11, 2025
fb77319
Create .redocly.lint-ignore.yaml
janetjotw Mar 11, 2025
33d0183
Update docs.yml
janetjotw Mar 11, 2025
b00f3e4
Update docs.yml
janetjotw Mar 12, 2025
213baad
Update docs.yml
janetjotw Mar 12, 2025
ec2fbc1
Update api-v1.yaml
janetjotw Mar 12, 2025
25b5f86
Update api-v1.yaml
janetjotw Mar 12, 2025
340e7d7
Update api-v1.yaml
janetjotw Mar 12, 2025
d7b9de7
Update api-v1.yaml
janetjotw Mar 12, 2025
31a4915
Update api-v1.yaml
janetjotw Mar 12, 2025
91202f4
Update api-v1.yaml
janetjotw Mar 12, 2025
bb1e958
Update README.md
janetjotw Mar 12, 2025
21799dc
Update README.md
janetjotw Mar 12, 2025
bd08149
Update docs.yml
janetjotw Mar 25, 2025
01606ea
Update README.md
janetjotw Apr 5, 2025
b3441ca
Update README.md
janetjotw Apr 5, 2025
fd350a0
Add files via upload
janetjotw Apr 5, 2025
46661c0
Create v2
janetjotw May 7, 2025
4d31cfa
Delete api-specs/v2
janetjotw May 7, 2025
f804744
New API Manjors spec
May 7, 2025
274b6ed
Merge branch 'main' into Majors-branchAPI
janetjotw May 7, 2025
099123c
Merge pull request #4 from janetjotw/Majors-branchAPI
janetjotw May 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This is a basic workflow to help you get started with Actions

name: CI - Build API and deploy API spec

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!

# Set up Node.js
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

# Install Redocly CLI
- name: Install Redocly CLI
run: npm install -g @redocly/cli

# Lint OpenAPI spec
- name: Lint OpenAPI Spec
run: redocly lint api-specs/api-v1.yaml

# Build docs
- name: Build Docs
run: |
redocly build-docs api-specs/api-v1.yaml --output docs/index.html

25 changes: 25 additions & 0 deletions .redocly.lint-ignore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file instructs Redocly's linter to ignore the rules contained for specific parts of your API.
# See https://redocly.com/docs/cli/ for more information.
api-specs/api-v1.yaml:
info-license:
- '#/info'
no-server-example.com:
- '#/servers/0/url'
operation-operationId:
- '#/paths/products/get/operationId'
- '#/paths/products/post/operationId'
- '#/paths/products~1productId/get/operationId'
- '#/paths/products~1productId/put/operationId'
- '#/paths/products~1productId/delete/operationId'
operation-4xx-response:
- '#/paths/products/get/responses'
- '#/paths/products/post/responses'
- '#/paths/products~1productId/get/responses'
- '#/paths/products~1productId/put/responses'
- '#/paths/products~1productId/delete/responses'
security-defined:
- '#/paths/products/get'
- '#/paths/products/post'
- '#/paths/products~1productId/get'
- '#/paths/products~1productId/put'
- '#/paths/products~1productId/delete'
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
# create-cicd-automation
# Open API Spec and CI/CD to Redocly

## Introduction

This repository demonstrates the use of an OpenAPI specification and the deployment of an API using GitHub Actions. Special thanks to Łukasz Michta for his "CI/CD for Technical Writers with OpenAPI and Redocly" tutorial, which served as the foundation for this project. I adapted and refined the API to align with my use case.

## What is Redocly

Redocly is a platform designed to streamline and enhance the process of creating, managing, and publishing API documentation. Redocly helps generate interactive and visually appealing API documentation from OpenAPI specifications. It transforms raw API definitions into developer-friendly documentation.

**The OpenAPI YAML API**

> api-specs/api-v1.yaml

*Sample view of the Products API*

[Products API](docs/API-screen.png)





6 changes: 3 additions & 3 deletions api-specs/api-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ paths:
description: Internal Server Error
/products/{productId}:
get:
summary: Get product by ID
summary: Get product by ID.
security:
- ApiKeyAuth: []
parameters:
Expand All @@ -81,7 +81,7 @@ paths:
500:
description: Internal Server Error
put:
summary: Update product
summary: Update product.
security:
- ApiKeyAuth: []
parameters:
Expand Down Expand Up @@ -180,4 +180,4 @@ components:
securitySchemes:
ApiKeyAuth:
type: http
scheme: basic
scheme: basic
68 changes: 68 additions & 0 deletions api-specs/v2/api-majors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
openapi: 3.0.1
info:
title: CMC Majors
version: v1
paths:
/popularity:
get:
summary: Get popularity by major
responses:
'200':
description: OK
headers:
x-amzn-requestid:
schema:
description: ID of the Amazon request
type: string
content:
application/json:
schema:
type: object
properties:
class:
type: string
breakdown:
type: array
items:
type: object
properties:
major:
type: string
count:
type: integer
parameters:
- name: class
in: query
required: true
schema:
type: string
example: "2025"
/majors:
post:
summary: Add a major
requestBody:
content:
application/json:
$ref: '#/components/schemas/major'
responses:
'200':
description: OK
content:
application/json:
$ref: '#/components/schemas/major'
security:
- admin: []
components:
schemas:
major:
type: object
properties:
major:
type: string
examples:
- APIs
securitySchemes:
admin:
type: http
scheme: bearer
bearerFormat: JWT
Binary file added docs/API-screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf8" />
<title>Products API</title>
Expand Down Expand Up @@ -445,5 +444,15 @@

</script>
</body>

<head>
<title>API Reference Docs</title>
<!-- Redoc CDN -->
<script src="https://cdn.redoc.ly/reference-docs/v2.13.5/redoc.standalone.js"></script>
</head>
<body>
<div id="redoc-container"></div>
<script>
Redoc.init('api-specs/api-v1.yaml', {}, document.getElementById('redoc-container'));
</script>
</body>
</html>