Skip to content

Commit

Permalink
update license, readme, and codeowners
Browse files Browse the repository at this point in the history
  • Loading branch information
chinatsu committed Mar 18, 2022
1 parent a155cda commit 4ccc454
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 44 deletions.
26 changes: 7 additions & 19 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ on:
push:
branches:
- master
paths-ignore:
- README.md

env:
IMAGE: docker.pkg.github.com/${{ github.repository }}/pdfgen:${{ github.sha }}
GITHUB_SHA: ${{ github.sha }}
DOCKERHUB_IMAGE: navikt/pdfgen

IMAGE: ghcr.io/${{ github.repository }}
jobs:
build:
name: Build and push docker image
Expand Down Expand Up @@ -45,24 +44,13 @@ jobs:
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew shadowJar -x test
echo "version=$(./gradlew -q printVersion)" >> $GITHUB_ENV
echo "VERSION=$(./gradlew -q printVersion)" >> $GITHUB_ENV
- name: Build Docker images
run: |
docker build --tag ${IMAGE} .
docker build --tag ${IMAGE}:${VERSION}
- name: Push docker image to GitHub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
docker push ${IMAGE}
- name: Push docker image to Dockerhub
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
docker login -u martinsolheim -p ${DOCKERHUB_TOKEN}
docker tag ${IMAGE} ${DOCKERHUB_IMAGE}:latest
docker tag ${IMAGE} ${DOCKERHUB_IMAGE}:${GITHUB_SHA}
docker tag ${IMAGE} ${DOCKERHUB_IMAGE}:${version}
docker push ${DOCKERHUB_IMAGE}:latest
docker push ${DOCKERHUB_IMAGE}:${GITHUB_SHA}
docker push ${DOCKERHUB_IMAGE}:${version}
docker login ghcr.io -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
docker push ${IMAGE}:${VERSION}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
branches:
- '*'
- '!master'
env:
IMAGE: docker.pkg.github.com/${{ github.repository }}/pdfgen:${{ github.sha }}

jobs:
build:
Expand Down Expand Up @@ -37,9 +35,3 @@ jobs:
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew test
- name: Build jar
env:
ORG_GRADLE_PROJECT_githubUser: x-access-token
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew shadowJar -x test
4 changes: 2 additions & 2 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
* @navikt/integrasjon
* @navikt/digisyfo
# benevolent dictator until further notice? :)
* @chinatsu
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 NAV (Arbeids- og velferdsdirektoratet) - The Norwegian Labour and Welfare Administration
Copyright (c) 2022 NAV (Arbeids- og velferdsdirektoratet) - The Norwegian Labour and Welfare Administration

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
51 changes: 37 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# PdfGen
# pdfgen

![Build and publish](https://github.com/navikt/pdfgen/workflows/Build%20and%20publish/badge.svg)

Repository for PdfGen, an application written in Kotlin used to create PDFs
Repository for `pdfgen`, an application written in Kotlin used to create PDFs

## Technologies & Tools

Expand All @@ -11,8 +11,40 @@ Repository for PdfGen, an application written in Kotlin used to create PDFs
* Ktor
* Spek
* Handlebars
* VeraPDF-validation

## Getting started

Most commonly, pdfgen is used as a base image alongside templates, fonts, additional resources, and potential test data to verify that valid PDFs get produced by the aforementioned templates.

In your own repository, create a Dockerfile with the following contents

```dockerfile
# Dockerfile
FROM ghcr.io/navikt/pdfgen/pdfgen:a155cdaac6fcfebe60f1a2b012c1943b5b8f7bc0

COPY templates /app/templates # handlebars templates
COPY fonts /app/fonts # fonts to be embedded
COPY resources /app/resources # additional resources
```

Set up the basic folder structure
```bash
mkdir {templates,fonts,resources,data}
```

Create subfolders in `templates` and `data`
```bash
mkdir {templates,data}/your_teamname # your_teamname can be anything, but it'll be a necessary part of the API later
```

* `templates/your_teamname/` should then be populated with your .hbs-templates. the names of these templates will also decide parts of the API paths
* `data/your_teamname/` should be populated with json files with names corresponding to a target .hbs-template, this can be used to test your PDFs during development of templates.

[navikt/flex-sykepengesoknad-pdfgen](https://github.com/navikt/flex-sykepengesoknad-pdfgen) is a good example of how such a project can be set up.

## Developing pdfgen

### Build and run tests
`./gradlew shadowJar`

Expand All @@ -23,19 +55,10 @@ making this ideal for developing new templates for your application.

The template and data directory structure both follow the `<application>/<template>` structure.

### Notes on developing templates on Windows
It is a known issue that pdfgen's output documents look different depending on whether the template
has `\r\n` or `\n` as line endings. Therefore, it is strongly recommended to configure Git to not convert newlines, as well as ensure that your editor ends its lines with LF (`\n`) and not CRLF (`\r\n`), as the former will accurately show what your
templates will look like in production.

## Contact us
### Code/project related questions can be sent to
* Kent Daleng, `[email protected]`
* Kevin Sillerud, `[email protected]`
* Andreas Nilsen, `[email protected]`
* Sebastian Knudsen, `[email protected]`
* Tia Firing, `[email protected]`
* Jonas Henie, `[email protected]`
* Mathias Hellevang, `[email protected]`


### For NAV employees
We are also available on the slack channel #integrasjon or #team-sykmelding for internal communication.
We are also available on the slack channel #pdfgen for internal communication.

0 comments on commit 4ccc454

Please sign in to comment.