Deploy to NAIS #12
This file contains hidden or 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
| name: Deploy to NAIS | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| registry: | |
| description: Registry, for example "europe-north1-docker.pkg.dev" | |
| required: true | |
| type: string | |
| repository: | |
| description: Registry repository | |
| required: true | |
| type: string | |
| image-name: | |
| description: Image name | |
| required: true | |
| type: string | |
| image-tag: | |
| description: Tag for the image | |
| required: true | |
| type: string | |
| cluster: | |
| description: NAIS cluster environment | |
| required: true | |
| type: string | |
| nais-config-path: | |
| description: Path to the NAIS configuration file | |
| required: true | |
| type: string | |
| ref: | |
| description: Commit reference of the deployment | |
| required: false | |
| default: master | |
| type: string | |
| workflow_call: | |
| inputs: | |
| registry: | |
| description: Registry, for example "europe-north1-docker.pkg.dev" | |
| required: true | |
| type: string | |
| repository: | |
| description: Registry repository | |
| required: true | |
| type: string | |
| image-name: | |
| description: Image name | |
| required: true | |
| type: string | |
| image-tag: | |
| description: Tag for the image | |
| required: true | |
| type: string | |
| cluster: | |
| description: NAIS cluster environment | |
| required: true | |
| type: string | |
| nais-config-path: | |
| description: Path to the NAIS configuration file | |
| required: true | |
| type: string | |
| ref: | |
| description: Commit reference of the deployment | |
| required: false | |
| default: master | |
| type: string | |
| jobs: | |
| deploy: | |
| name: Deploy to NAIS cluster | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/create-github-app-token@v1 | |
| id: app-token | |
| with: | |
| app-id: ${{ secrets.DAPLA_BOT_APP_ID }} | |
| private-key: ${{ secrets.DAPLA_BOT_PRIVATE_KEY }} | |
| owner: statisticsnorway | |
| repositories: dapla-pseudo-iac | |
| - uses: actions/checkout@v4 | |
| name: Retrieve protected configuration | |
| with: | |
| repository: "statisticsnorway/dapla-pseudo-iac" | |
| path: "ext-config" | |
| token: ${{ steps.app-token.outputs.token }} | |
| sparse-checkout: | | |
| apps/nais/pseudo-service/${{ inputs.cluster }} | |
| - name: Configure environment variables | |
| run: | | |
| ext_config_dir="ext-config/apps/nais/pseudo-service/${{ inputs.cluster }}" | |
| echo "ext_config=${ext_config_dir}" >> $GITHUB_ENV | |
| - uses: nais/deploy/actions/deploy@v2 | |
| env: | |
| CLUSTER: ${{ inputs.cluster }} | |
| RESOURCE: ${{ inputs.nais-config-path }},${{ env.ext_config }}/app-roles.yml | |
| VAR: image=${{ inputs.registry }}/${{ secrets.NAIS_MANAGEMENT_PROJECT_ID }}/${{ inputs.repository }}/${{ inputs.image-name }}:${{ inputs.image-tag }},team=dapla-stat | |
| DEPLOY_SERVER: deploy.ssb.cloud.nais.io:443 | |
| REF: ${{ inputs.ref }} |