Skip to content

Commit

Permalink
feat: add github actions (#1)
Browse files Browse the repository at this point in the history
Add github actions:

- lint the codebase on each push in a merge request
- deploy a release to dockerhub
  • Loading branch information
olegstepura authored Dec 30, 2021
1 parent 2bfe4bd commit c955909
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Quality check

on: push

jobs:
lint-test:
runs-on: ubuntu-latest
env:
TAG: html-to-pdf
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'yarn'
- run: yarn install
- run: yarn lint --max-warnings 0
- name: Build container
run: docker build --file deploy/test/Dockerfile --tag ${TAG} .
- name: Run test in a container
run: docker run --rm ${TAG} yarn test
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release version

on:
push:
branches:
- 'main'
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'yarn'
- uses: docker/metadata-action@v3
id: metadata
with:
images: muehlemannpopp/html-to-pdf
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: int128/kaniko-action@v1
with:
push: true
file: deploy/prod/Dockerfile
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
2 changes: 1 addition & 1 deletion deploy/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ENV \
USER root

WORKDIR /app
COPY .. /app
COPY . /app

RUN chown -R chrome ./

Expand Down
2 changes: 1 addition & 1 deletion deploy/prod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ENV \
WORKDIR /usr/src/app
COPY --from=builder /app/build/main.prod.js .
COPY favicon.ico .
COPY deploy/services/printer/docker-entrypoint.sh /docker-entrypoint.sh
COPY deploy/prod/docker-entrypoint.sh /docker-entrypoint.sh
COPY README.md .

ENTRYPOINT ["tini", "--"]
Expand Down
2 changes: 1 addition & 1 deletion deploy/test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

WORKDIR /app
COPY .. /app
COPY . /app

# change user to bypass write limitations
USER root
Expand Down

0 comments on commit c955909

Please sign in to comment.