Skip to content

Commit

Permalink
Bytt til GAR (#1696)
Browse files Browse the repository at this point in the history
* Bytt til GAR

* Vi bruker ikke cypress her
  • Loading branch information
UyQuangNguyen authored Mar 13, 2024
1 parent bebe3d4 commit 16587ae
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 60 deletions.
23 changes: 7 additions & 16 deletions .github/workflows/build.yaml
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}
44 changes: 26 additions & 18 deletions .github/workflows/build_n_deploy_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,58 @@ on:
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
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}
docker push ${IMAGE}
deploy:
if: github.event.pull_request.draft == false && github.actor != 'dependabot[bot]'
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 }}
VAR: image=${{ needs.build.outputs.image }},VERSION=${{ env.VERSION }}
67 changes: 41 additions & 26 deletions .github/workflows/build_n_deploy_prod.yaml
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 }}

0 comments on commit 16587ae

Please sign in to comment.