diff --git a/.github/workflows/hege-deploy-staging.yaml b/.github/workflows/hege-deploy-staging.yaml new file mode 100644 index 000000000..06642c571 --- /dev/null +++ b/.github/workflows/hege-deploy-staging.yaml @@ -0,0 +1,53 @@ +name: Deploy to staging + +on: + pull_request: + types: [ready_for_review, opened, reopened, synchronize] + branches: + - main + +jobs: + test: + name: Test and build + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + # We need to fetch all branches and commits so that Nx affected has a base to compare against. + fetch-depth: 0 + - name: Caching Dist Folder + uses: actions/cache@v4 + with: + path: ./dist + key: cache-dist-${{ github.sha }} + + build: + name: Build affected apps when pull request is created + needs: [test] + uses: Informasjonsforvaltning/workflows/.github/workflows/build-push.yaml@main + with: + app_name: catalog-portal-frontend + monorepo_app: true + environment: staging + build_env: true + build_env_name: BINARY + build_env_value: catalog-portal-frontend + dockerfile: apps/catalog-portal/Dockerfile + secrets: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + deploy: + name: Deploy affected apps to staging environment with reusable workflow + needs: [test, build] + uses: Informasjonsforvaltning/workflows/.github/workflows/kustomize-deploy.yaml@main + with: + app_name: catalog-portal-frontend + environment: staging + monorepo_app: true + cluster: digdir-fdk-dev + secrets: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DIGDIR_FDK_AUTODEPLOY: ${{ secrets.DIGDIR_FDK_DEV_AUTODEPLOY }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}