-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bytt til GAR * Vi bruker ikke cypress her
- Loading branch information
1 parent
bebe3d4
commit 16587ae
Showing
3 changed files
with
74 additions
and
60 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 |
---|---|---|
@@ -1,41 +1,32 @@ | ||
name: Build | ||
name: Build PR | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
workflow_dispatch: | ||
|
||
env: | ||
IMAGE: ghcr.io/navikt/familie-tilbake-frontend:${{ github.sha }} | ||
VERSION: familie-tilbake-frontend:${{ github.sha }} | ||
|
||
jobs: | ||
build: | ||
name: Build and push Docker container | ||
name: Build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18' | ||
cache: yarn | ||
registry-url: "https://npm.pkg.github.com" | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@3d58c274f17dffee475a5520cbe67f0a882c4dbb | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and publish Docker image | ||
- name: Yarn install | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | ||
run: yarn --prefer-offline --frozen-lockfile | ||
- name: Build | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||
SENTRY_RELEASE: ${{ github.sha }} | ||
run: | | ||
yarn | ||
yarn build | ||
yarn test | ||
docker build . -t ${IMAGE} | ||
docker push ${IMAGE} |
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
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,64 +1,79 @@ | ||
name: Build&deploy to prod | ||
name: Build&deploy to dev and prod | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
- 'main' | ||
|
||
env: | ||
IMAGE: ghcr.io/navikt/familie-tilbake-frontend:${{ github.sha }} | ||
IMAGE_LATEST: ghcr.io/navikt/familie-tilbake-frontend:latest | ||
VERSION: familie-tilbake-frontend:${{ github.sha }} | ||
|
||
jobs: | ||
build: | ||
name: Build and push Docker container | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
id-token: write | ||
outputs: | ||
image: ${{ steps.docker-build-push.outputs.image }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18' | ||
cache: yarn | ||
registry-url: "https://npm.pkg.github.com" | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@3d58c274f17dffee475a5520cbe67f0a882c4dbb | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and publish Docker image | ||
- name: Yarn install | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | ||
run: yarn --prefer-offline --frozen-lockfile | ||
|
||
- name: Build | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||
SENTRY_RELEASE: ${{ github.sha }} | ||
run: | | ||
yarn | ||
yarn build | ||
yarn test | ||
docker build . -t ${IMAGE} -t ${IMAGE_LATEST} | ||
docker push ${IMAGE} | ||
docker push ${IMAGE_LATEST} | ||
deploy: | ||
name: Deploy to NAIS / GCP | ||
- name: Push docker image to GAR | ||
uses: nais/docker-build-push@v0 | ||
id: docker-build-push | ||
with: | ||
team: teamfamilie | ||
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} # Provided as Organization Secret | ||
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} # Provided as Organization Variable | ||
|
||
deployDev: | ||
name: Deploy to gcp-dev | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Deploy til dev-gcp | ||
- name: Deploy til dev-gcp team namespace | ||
uses: nais/deploy/actions/deploy@v2 | ||
env: | ||
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | ||
CLUSTER: dev-gcp | ||
RESOURCE: build_n_deploy/naiserator/naiserator_dev_gcp.yaml | ||
VAR: VERSION=${{ env.VERSION }} | ||
- name: Deploy til prod-gcp | ||
RESOURCE: build_n_deploy/naiserator/gcp-dev.yaml | ||
VAR: image=${{ needs.build.outputs.image }},VERSION=${{ env.VERSION }} | ||
|
||
deployProd: | ||
name: Deploy to gcp-prod | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Deploy til prod-gcp team namespace | ||
uses: nais/deploy/actions/deploy@v2 | ||
env: | ||
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | ||
CLUSTER: prod-gcp | ||
RESOURCE: build_n_deploy/naiserator/naiserator_prod_gcp.yaml | ||
VAR: VERSION=${{ env.VERSION }} | ||
VAR: image=${{ needs.build.outputs.image }},VERSION=${{ env.VERSION }} |