Skip to content

Commit

Permalink
Bedre prettier-oppsett (#19)
Browse files Browse the repository at this point in the history
* Oppgrader prettier, flytt config til package.json

* Formater filer

* Formateringsscript og prettier ignore

* Formater resten av uformaterte filer

* Legg til pre-commit hook for prettier
  • Loading branch information
kjesvale authored Dec 3, 2021
1 parent 53152d3 commit 554c00f
Show file tree
Hide file tree
Showing 17 changed files with 468 additions and 276 deletions.
111 changes: 55 additions & 56 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,64 @@
name: Bygg og deploy

on:
[ push ]
on: [push]

env:
IMAGE: docker.pkg.github.com/${{ github.repository }}/vis-stilling:${{ github.sha }}
IMAGE: docker.pkg.github.com/${{ github.repository }}/vis-stilling:${{ github.sha }}

jobs:
bygg-og-push-docker-image:
name: Bygg applikasjon
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 10
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
bygg-og-push-docker-image:
name: Bygg applikasjon
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 10
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Installer avhengigheter
run: npm ci
- name: Bygg applikasjon
run: npm run build
- name: Installer avhengigheter for server
run: npm run server:install
- name: Bygg server
run: npm run server:build
- name: Bygg og publiser Docker-image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker build --tag ${IMAGE} .
echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} --password-stdin
docker push ${IMAGE}
- name: Installer avhengigheter
run: npm ci
- name: Bygg applikasjon
run: npm run build
- name: Installer avhengigheter for server
run: npm run server:install
- name: Bygg server
run: npm run server:build
- name: Bygg og publiser Docker-image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker build --tag ${IMAGE} .
echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} --password-stdin
docker push ${IMAGE}
deploy-til-dev:
name: Deploy til dev
needs: bygg-og-push-docker-image
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rename-rekrutteringsbistand-api'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: nais-dev.yaml
deploy-til-dev:
name: Deploy til dev
needs: bygg-og-push-docker-image
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rename-rekrutteringsbistand-api'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: nais-dev.yaml

deploy-to-prod:
name: Deploy til prod
needs: deploy-til-dev
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: nais-prod.yaml
deploy-to-prod:
name: Deploy til prod
needs: deploy-til-dev
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: nais-prod.yaml
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx pretty-quick --staged
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.md
build
package-lock.json
7 changes: 0 additions & 7 deletions .prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions nais-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
team: arbeidsgiver
spec:
# prettier-ignore
image: {{ image }}
port: 3000
ingresses:
Expand Down
1 change: 1 addition & 0 deletions nais-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
team: arbeidsgiver
spec:
# prettier-ignore
image: {{ image }}
port: 3000
ingresses:
Expand Down
Loading

0 comments on commit 554c00f

Please sign in to comment.