-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use GitHub actions build and container images. (#4) Swtich build system from rollup to esbuild. (#3)
- Loading branch information
Showing
15 changed files
with
414 additions
and
1,238 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.git | ||
elm-stuff | ||
node_modules | ||
public/index.js |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Create and publish openapi-explorer image | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Lower-case repository name | ||
run: | | ||
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build image | ||
id: build-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: ${{ env.IMAGE_NAME }} | ||
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 }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
image: ${{ steps.build-image.outputs.image }} | ||
tags: ${{ steps.build-image.outputs.tags }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM docker.io/library/node:16.9.1-alpine AS build | ||
WORKDIR /app | ||
COPY . . | ||
RUN yarn install --dev && yarn build | ||
|
||
FROM ghcr.io/ananthb/thttpd-container | ||
COPY --from=build /app/public /srv |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {build, serve} from "esbuild"; | ||
import ElmPlugin from "esbuild-plugin-elm"; | ||
|
||
const productionBuild = process.env.NODE_ENV === "production"; | ||
const buildOpts = { | ||
entryPoints: ["index.js"], | ||
bundle: true, | ||
outdir: "public", | ||
plugins: [ElmPlugin({ debug: !productionBuild })], | ||
minify: productionBuild, | ||
} | ||
|
||
try { | ||
productionBuild ? | ||
await build(buildOpts) : | ||
await serve({ servedir: "public" }, buildOpts); | ||
} catch (error) { | ||
console.error(error); | ||
process.exit(1); | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
{ | ||
"devDependencies": { | ||
"elm-format": "^0.8.3" | ||
"elm-format": "^0.8.3", | ||
"esbuild": "^0.12.28", | ||
"esbuild-plugin-elm": "^0.0.4" | ||
}, | ||
"dependencies": { | ||
"@rollup/plugin-node-resolve": "^7.1.3", | ||
"elm": "^0.19.1-3", | ||
"rapidoc": "^8.0.0", | ||
"rollup": "^2.7.6", | ||
"rollup-plugin-elm": "^2.0.2", | ||
"rollup-plugin-terser": "^5.3.0" | ||
"elm": "^0.19.1-5", | ||
"rapidoc": "^9.0.0" | ||
}, | ||
"name": "openapi-explorer", | ||
"version": "1.0.0", | ||
"type": "module", | ||
"main": "index.js", | ||
"license": "UNLICENSED", | ||
"private": true, | ||
"scripts": { | ||
"start": "rollup -c --watch", | ||
"build": "rollup -c --environment TERSE" | ||
"watch": "node ./build.js", | ||
"build": "env NODE_ENV=production node ./build.js" | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.