Skip to content

Commit

Permalink
Refaktorisering av workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-CT committed Aug 16, 2023
1 parent 57c9cb2 commit 818ab77
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 81 deletions.
28 changes: 3 additions & 25 deletions .github/workflows/auto-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,6 @@ on:
- cron: '0 08 * * 1' # kl 09 hver mandag

jobs:
build-and-test:
name: Test frontend
uses: ./.github/workflows/test.yml

build-and-push:
name: Build and push Docker container for prod
uses: ./.github/workflows/build-push.yml
with:
environment: prod
secrets: inherit

deploy-prod:
name: Deploy to prod
needs: [build-and-test, build-and-push]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
DRY_RUN: false
PRINT_PAYLOAD: true
CLUSTER: prod-gcp
RESOURCE: .nais/nais.yml
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}
build-push-deploy-main:
uses: ./.github/workflows/main.yml
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths-ignore:
- '**.md'
- '**/**.md'
workflow_call:

jobs:
build-and-test:
Expand Down
67 changes: 11 additions & 56 deletions .github/workflows/manual-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,62 +14,17 @@ on:
- prod

jobs:
build-and-test:
name: Test frontend
uses: ./.github/workflows/test.yml

build-and-push:
name: Build and push Docker container for ${{ inputs.environment }}
uses: ./.github/workflows/build-push.yml
with:
environment: ${{ inputs.environment }}
preprod:
if: inputs.environment == 'preprod'
uses: ./.github/workflows/preprod.yml
secrets: inherit

deploy-preprod:
name: Deploy to preprod
needs: [build-and-test, build-and-push]
if: github.event.inputs.environment == 'preprod'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
DRY_RUN: false
PRINT_PAYLOAD: true
CLUSTER: dev-gcp
RESOURCE: .nais/nais-preprod.yml
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}

deploy-preprod-alt:
name: Deploy to preprod-alt
needs: [build-and-test, build-and-push]
if: github.event.inputs.environment == 'preprod-alt'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
DRY_RUN: false
PRINT_PAYLOAD: true
CLUSTER: dev-gcp
RESOURCE: .nais/nais-preprod-alt.yml
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}

deploy-prod:
name: Deploy to prod
needs: [build-and-test, build-and-push]
if: github.event.inputs.environment == 'prod'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
DRY_RUN: false
PRINT_PAYLOAD: true
CLUSTER: prod-gcp
RESOURCE: .nais/nais.yml
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}
preprod-alt:
if: inputs.environment == 'preprod-alt'
uses: ./.github/workflows/preprod-alt.yml
secrets: inherit

prod:
if: inputs.environment == 'prod'
uses: ./.github/workflows/main.yml
secrets: inherit
29 changes: 29 additions & 0 deletions .github/workflows/preprod-alt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build, push, and deploy (preprod)
on: workflow_call

jobs:
build-and-test:
name: Test frontend
uses: ./.github/workflows/test.yml

build-and-push:
name: Build and push Docker container for preprod
uses: ./.github/workflows/build-push.yml
with:
environment: preprod-alt
secrets: inherit

deploy-preprod:
name: Deploy to preprod-alt
needs: [build-and-test, build-and-push]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
DRY_RUN: false
PRINT_PAYLOAD: true
CLUSTER: dev-gcp
RESOURCE: .nais/nais-preprod-alt.yml
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}
1 change: 1 addition & 0 deletions .github/workflows/preprod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths-ignore:
- '**.md'
- '**/**.md'
workflow_call:

jobs:
build-and-test:
Expand Down

0 comments on commit 818ab77

Please sign in to comment.