-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch master into Dialog-ved-opplastning-av-fil
- Loading branch information
Showing
36 changed files
with
8,941 additions
and
27,618 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Build Image Action @ sosialhjelp-soknad | ||
|
||
Inneholder gjenbrukbar logikk relevant for `sosialhjelp-soknad` for å | ||
bygge et docker image. | ||
|
||
### Inputs | ||
|
||
- `prefix`: sosialhjelp-soknad lager tags basert på config. (prod-sbs, dev-sbs, mock) | ||
|
||
### Outputs | ||
|
||
- `full-tag`: Den fulle taggen inkludert prefix og artifact version | ||
|
||
### Eksempel på bruk: | ||
|
||
```yaml | ||
- name: "Build Docker Image" | ||
uses: navikt/sosialhjelp-soknad/.github/actions/build-image@master | ||
with: | ||
prefix: ${{ env.REACT_APP_DIGISOS_ENV }} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: 'Build Docker Image' | ||
description: 'Create tag and release, Build code, artifact and Docker Image.' | ||
|
||
inputs: | ||
prefix: | ||
required: true | ||
description: 'Tag prefix (prod/dev)' | ||
|
||
outputs: | ||
full-tag: | ||
description: 'Full tag' | ||
value: ${{ steps.final-tag.outputs.tag }} | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: 'Build npm artifact' | ||
uses: navikt/sosialhjelp-ci/actions/build-npm@v2-beta | ||
with: | ||
reader-token: ${{ env.READER_TOKEN }} | ||
build-less: 'true' | ||
run-orval: 'true' | ||
run-test: 'false' | ||
|
||
- name: 'Create artifact version' | ||
id: artifact-version | ||
uses: navikt/sosialhjelp-ci/actions/create-artifact-version@v2 | ||
|
||
- name: 'Tag with prefix' | ||
id: final-tag | ||
run: | | ||
echo "tag=${{ inputs.prefix }}-${{ steps.artifact-version.outputs.version }}" >> $GITHUB_OUTPUT | ||
shell: bash | ||
|
||
- name: 'Release Tag' | ||
uses: ncipollo/release-action@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | ||
with: | ||
tag: ${{ steps.final-tag.outputs.tag }} | ||
commit: ${{ github.sha }} | ||
allowUpdates: true | ||
|
||
- name: 'Build and Push Docker Image' | ||
uses: navikt/sosialhjelp-ci/actions/build-and-push-docker-image@v2-beta | ||
with: | ||
artifact-version: ${{ steps.final-tag.outputs.tag }} | ||
image-name: ${{ env.DOCKER_IMAGE }} | ||
github-token: ${{ env.WORKFLOW_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: 'Build code and run test' | ||
on: | ||
push: | ||
branches: | ||
- '**' # Build all branches | ||
tags-ignore: | ||
- '**' # Don't build any tags | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_code: | ||
name: 'Build Code and run Tests' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: read | ||
env: | ||
REACT_APP_DIGISOS_ENV: dev-sbs # tester er pr. nå avhengig av denne | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: 'Build npm project and run Tests' | ||
uses: navikt/sosialhjelp-ci/actions/build-npm@v2-beta | ||
with: | ||
reader-token: ${{ secrets.READER_TOKEN }} | ||
build-less: 'true' | ||
run-orval: 'true' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,53 @@ | ||
name: Build and deploy to mock-ekstern | ||
name: 'Build and deploy to mock-ekstern' | ||
run-name: Deploy '${{ github.ref_name }}' to 'mock' | ||
on: | ||
push: | ||
branches: [master] | ||
workflow_dispatch: {} | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
actions: write | ||
push: | ||
branches: [master] | ||
workflow_dispatch: | ||
env: | ||
REACT_APP_DIGISOS_ENV: mock | ||
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }} | ||
|
||
# FIXME: Legg til docker layer caching, f.eks. https://github.com/marketplace/actions/build-docker-images-using-cache | ||
jobs: | ||
build: | ||
name: Build and deploy to dev | ||
runs-on: ubuntu-latest | ||
build-image: | ||
name: 'Build Artifact and Image' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
docker-tag: ${{ steps.docker-image.outputs.full-tag }} | ||
permissions: | ||
contents: write | ||
packages: write | ||
actions: write | ||
env: | ||
REACT_APP_DIGISOS_ENV: mock | ||
READER_TOKEN: ${{ secrets.READER_TOKEN }} | ||
WORKFLOW_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: 'Build Docker Image' | ||
id: docker-image | ||
uses: navikt/sosialhjelp-soknad/.github/actions/build-image@master | ||
with: | ||
prefix: ${{ env.REACT_APP_DIGISOS_ENV }} | ||
|
||
deploy-app: | ||
name: 'Deploy Applicationo' | ||
runs-on: ubuntu-latest | ||
needs: build-image | ||
permissions: | ||
packages: write | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- id: docker-image-tag | ||
run: | | ||
echo "IMAGE_TAG=${{ env.DOCKER_IMAGE }}:${{ needs.build-image.outputs.docker-tag }}" >> $GITHUB_ENV | ||
- name: Deploy til dev | ||
uses: nais/deploy/actions/deploy@v1 | ||
env: | ||
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/sosialhjelp-soknad | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
registry-url: "https://npm.pkg.github.com" | ||
cache: "npm" | ||
- name: Install dependencies | ||
run: npm ci | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | ||
- name: Generate code from OpenAPI | ||
run: npm run orval | ||
- name: Run tests | ||
run: npm run test | ||
- name: Build less | ||
run: npm run build:css | ||
- name: Build application | ||
run: npm run build | ||
- name: Login to GitHub Docker Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create artifact version | ||
id: artifact-version | ||
uses: navikt/sosialhjelp-ci/actions/create-artifact-version@master | ||
- name: Get complete tag | ||
run: | | ||
echo "COMPLETE_TAG=${{ env.REACT_APP_DIGISOS_ENV }}-$( date +%s )-${{ steps.artifact-version.outputs.version }}" >> $GITHUB_ENV | ||
- name: Create docker image tags | ||
run: | | ||
echo "DOCKER_TAG=${{ env.DOCKER_IMAGE }}:${{ env.COMPLETE_TAG }}" >> $GITHUB_ENV | ||
- name: Build docker image | ||
run: docker build -t ${{ env.DOCKER_TAG }} . | ||
- name: Push docker image | ||
run: | | ||
docker push ${{ env.DOCKER_TAG }} | ||
- name: Create tag and release | ||
uses: ncipollo/release-action@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag: ${{ env.COMPLETE_TAG }} | ||
commit: ${{ github.sha }} | ||
- name: Deploy til dev | ||
uses: nais/deploy/actions/deploy@v1 | ||
env: | ||
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | ||
RESOURCE: nais/mock.yaml | ||
CLUSTER: dev-gcp | ||
REF: ${{ github.sha }} | ||
PRINT_PAYLOAD: true | ||
IMAGE: ${{ env.DOCKER_TAG }} | ||
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | ||
RESOURCE: nais/mock.yaml | ||
CLUSTER: dev-gcp | ||
REF: ${{ github.sha }} | ||
PRINT_PAYLOAD: true | ||
IMAGE: ${{ env.IMAGE_TAG }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: 'Build dev-sbs Image' | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-image: | ||
name: 'Build prod-sbs Image' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
actions: write | ||
env: | ||
REACT_APP_DIGISOS_ENV: dev-sbs | ||
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }} | ||
READER_TOKEN: ${{ secrets.READER_TOKEN }} | ||
WORKFLOW_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: 'Build Docker Image' | ||
uses: navikt/sosialhjelp-soknad/.github/actions/build-image@master | ||
with: | ||
prefix: ${{ env.REACT_APP_DIGISOS_ENV }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Build prod-sbs image - HUSK MANUELL DEPLOY TIL PROD! | ||
on: | ||
workflow_run: | ||
workflows: ['Build code and run test'] | ||
branches: [master] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
build-image: | ||
name: 'Build prod-sbs Image' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
actions: write | ||
env: | ||
REACT_APP_DIGISOS_ENV: prod-sbs | ||
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }} | ||
READER_TOKEN: ${{ secrets.READER_TOKEN }} | ||
WORKFLOW_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: 'Build Docker Image' | ||
uses: navikt/sosialhjelp-soknad/.github/actions/build-image@master | ||
with: | ||
prefix: ${{ env.REACT_APP_DIGISOS_ENV }} |
Oops, something went wrong.