Skip to content

Commit

Permalink
Fix build?
Browse files Browse the repository at this point in the history
  • Loading branch information
ananthb committed Oct 3, 2024
1 parent b8be96d commit e554f60
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 33 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@ on:
pull_request:
branches:
- main

jobs:
build:
name: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.9.1'
cache: 'yarn'
- run: yarn install --dev
- run: yarn build
- uses: actions/upload-artifact@v2
with:
name: openapi-explorer
path: public
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '16.9.1'
cache: 'yarn'
- name: Build
run: |
yarn install --dev
yarn build
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: openapi-explorer
path: public
15 changes: 4 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches: ['main']

env:
REGISTRY: ghcr.io

jobs:
build-and-push-image:
runs-on: ubuntu-latest
Expand All @@ -15,27 +12,23 @@ jobs:
packages: write

steps:
- name: Lower-case repository name
run: |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Build image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
image: ${{ github.repository }}
tags: latest ${{ github.sha }}
dockerfiles: |
./Containerfile
- name: Push to ghcr.io
id: push-to-ghcr
uses: redhat-actions/push-to-registry@v2
with:
registry: ${{ env.REGISTRY }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
image: ${{ steps.build-image.outputs.image }}
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# openapi-explorer

Open API specifications are usually stored as YAML files which are hard
to read. This app will render YAML files in a legible format.

## Develop

- nodejs runtime
- yarn package manager

## Build
Install dependencies and build the Elm project.

Install dependencies and build the Elm project.

yarn install --dev
yarn build

## Deploy

Add APIs to the explorer by copying them to the public/apis folder and
generating an api index file.

- Each API collection must be in a separate subfolder of the **public/apis** folder.
- The API index file must be at **public/apis/index.json**.
- The API description must be at **public/apis/README.md**.
Expand All @@ -24,7 +28,7 @@ After the public/apis folder is populated, generate an APIs index using this com

pushd public; tree -J -P "*.yaml" apis | jq '{title: "<title>" , contents: .[0].contents}' > apis/index.json; popd

**Sample apis folder**
### Sample apis folder

public/apis/
├── content-manager
Expand All @@ -44,21 +48,17 @@ After the public/apis folder is populated, generate an APIs index using this com
├── storage.yaml
└── system.yaml


[public](public) folder will now have a static website that can be deployed to any web server.
The generated site does not depend on any external resources.

## Containers

openapi-explorer can be built and run in a container.
The /path/to/apis folder must contain valid API definitions along with a generated index.json file as described above.


podman build -t openapi-explorer .
podman run --rm -p 8080:8080 -v /path/to/apis:/srv/apis openapi-explorer

Pre-built containers are available on GitHub Container Registry:

podman pull ghcr.io/RealImage/openapi-explorer

*docker can directly substitute podman in the above commands*
Pre-built containers are available on GitHub Container Registry:

podman pull ghcr.io/ananthb/openapi-explorer

0 comments on commit e554f60

Please sign in to comment.