Skip to content

Commit

Permalink
feat: Add docker CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
andymac4182 committed Apr 26, 2023
1 parent 6ba3d64 commit e8f930f
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/pr-check.yml
Expand Up @@ -19,6 +19,7 @@ jobs:
prettier_status: ${{ steps.prettier.outcome }}
tests_status: ${{ steps.tests.outcome }}
build_status: ${{ steps.build.outcome }}
builddocker_status: ${{ steps.builddocker.outcome }}

steps:
- name: Harden Runner
Expand Down Expand Up @@ -62,16 +63,24 @@ jobs:
continue-on-error: true
run: npm run build -ws --if-present

- name: Run docker build
id: builddocker
continue-on-error: true
run: npm run build:docker -ws --if-present

- name: Report Errors
if: ${{ always() }}
run: |
echo "ESLint status: ${{ steps.eslint.outcome }}"
echo "Prettier status: ${{ steps.prettier.outcome }}"
echo "Tests status: ${{ steps.tests.outcome }}"
echo "Build status: ${{ steps.build.outcome }}"
echo "Build Docker status: ${{ steps.builddocker.outcome }}"
if [[ ${{ steps.eslint.outcome }} == 'failure' ]] \
|| [[ ${{ steps.prettier.outcome }} == 'failure' ]] \
|| [[ ${{ steps.tests.outcome }} == 'failure' ]] \
|| [[ ${{ steps.build.outcome }} == 'failure' ]]; then
|| [[ ${{ steps.build.outcome }} == 'failure' ]] \
|| [[ ${{ steps.builddocker.outcome }} == 'failure' ]] \
; then
exit 1
fi
26 changes: 26 additions & 0 deletions .github/workflows/release-please.yml
Expand Up @@ -8,13 +8,18 @@ permissions:

name: release-please

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
release-please:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write
packages: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
Expand Down Expand Up @@ -55,3 +60,24 @@ jobs:
npm publish -w @markdown-confluence/cli
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: packages/cli
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 5 additions & 0 deletions packages/cli/Dockerfile
@@ -0,0 +1,5 @@
FROM ghcr.io/puppeteer/puppeteer:19.11.0

COPY ./dist /app

CMD ["node", "/app/index.js"]
1 change: 1 addition & 0 deletions packages/cli/package.json
Expand Up @@ -7,6 +7,7 @@
"dev": "node esbuild.config.mjs",
"clidev": "npm run build && node ./dist/index.js",
"build": "tsc && node esbuild.config.mjs production",
"build:docker": "docker build .",
"fmt": "npx prettier --write src/",
"lint": "eslint --ignore-path ../../.eslintignore --ext .js,.ts src/",
"prettier-check": "npx prettier --check src/"
Expand Down
4 changes: 2 additions & 2 deletions packages/mermaid-puppeteer-renderer/package.json
Expand Up @@ -18,8 +18,8 @@
"license": "Apache 2.0",
"dependencies": {
"@markdown-confluence/lib": "3.7.0",
"mermaid": "^10.1.0",
"puppeteer": "^19.11.0"
"mermaid": "10.1.0",
"puppeteer": "19.11.0"
},
"publishConfig": {
"access": "public",
Expand Down

0 comments on commit e8f930f

Please sign in to comment.