Skip to content

Commit

Permalink
Merge 61444c4 into 1c564c7
Browse files Browse the repository at this point in the history
  • Loading branch information
isneezy committed Jan 24, 2023
2 parents 1c564c7 + 61444c4 commit 28bb4d6
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 38 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/.docker.yml

This file was deleted.

17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@ name: CI

on:
push:
paths-ignore:
- "**/*.md"
branches: [master, next]
paths-ignore: ["**/*.md"]
pull_request:
paths-ignore:
- "**/*.md"
branches: [master, next]
paths-ignore: ["**/*.md"]

jobs:
CI:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 14.x
- name: restore cache
uses: actions/cache@v2
with:
Expand All @@ -40,7 +38,10 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: build
run: yarn build
run: |
yarn build
cat packages/cli/dist/src/index.js
cat packages/service/dist/src/pdf-generator-service.js
- name: cache build
uses: actions/cache@v2
with:
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/container-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: container-images

on:
push:
branches: [master, next]
# paths: [packages/service, "!**/*.md"]
pull_request:
branches: [master, next]
# paths: [packages/service, "!**/*.md"]

jobs:
container-images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}

- name: Read container image tags
id: image-tags
run: |
echo "VERSION=$(cat packages/service/package.json | jq .version -r)" >> $GITHUB_OUTPUT
echo "BRANCH=$(echo "${{ github.head_ref || github.ref_name }}" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z)" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v3
with:
context: ./packages/service
tags:
isneezy/pdf-generator:${{ steps.image-tags.outputs.VERSION }},
isneezy/pdf-generator:${{ steps.image-tags.outputs.BRANCH }},
isneezy/pdf-generator:latest,

isneezy/pdf-generator-service:${{ steps.image-tags.outputs.VERSION }},
isneezy/pdf-generator-service:${{ steps.image-tags.outputs.BRANCH }},
isneezy/pdf-generator-service:latest,

quay.io/isneezy/pdf-generator-service:${{ steps.image-tags.outputs.VERSION }},
quay.io/isneezy/pdf-generator-service:${{ steps.image-tags.outputs.BRANCH }},
quay.io/isneezy/pdf-generator-service:latest,
push: ${{ (contains(github.ref, 'master') || contains(github.ref, 'next')) }}


# build-docker-image:
# # if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: build
# run: docker build --cache-from isneezy/pdf-generator -t isneezy/pdf-generator .
# - name: lanunch docker container
# run: docker run --rm -p 3000:3000 --name=service -d isneezy/pdf-generator
## - name: Test Generate Endpoint
## run: |
## curl -o test.pdf --location --request POST 'localhost:3000/generate' \
## --header 'Content-Type: application/json' \
## --data-raw '{
## "content": "<h2>Helo</h2>"
## }'
## stat test.pdf
# - name: cleanup
# run: docker rm -f service && docker image rm isneezy/pdf-generator:latest

2 changes: 1 addition & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[
"@semantic-release/git",
{
"assets": ["package.json", "CHANGELOG.md"],
"assets": ["package.json", "CHANGELOG.md", "packages/*/dist"],
"message": "chore(release): ${nextRelease.gitTag} [skip ci]\n\n${nextRelease.notes}"
}
],
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node

import { resolve } from 'path'
import { writeFileSync, existsSync, readFileSync } from 'fs'
import pkg from '../package.json'
Expand Down
1 change: 1 addition & 0 deletions packages/service/src/pdf-generator-service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node

import { program } from 'commander'
import pkg from '../package.json'
import { createApp } from './app'
Expand Down

0 comments on commit 28bb4d6

Please sign in to comment.