Unleash henter alltid fra development #664
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
name: Bygg og deploy master | |
on: | |
push: | |
branches: | |
- 'master' | |
env: | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
IMAGE: ghcr.io/${{ github.repository }}/tiltak-refusjon-api:${{ github.sha }} | |
jobs: | |
bygg: | |
name: Bygg | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Sjekk ut kode | |
uses: actions/checkout@v3 | |
- name: Oppsett Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Bygg og test med Maven | |
run: mvn package -B -Dsurefire.useFile=false | |
- name: Bygg, tag og push Docker-image | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo ${GITHUB_TOKEN} | docker login ghcr.io -u ${GITHUB_REPOSITORY} --password-stdin | |
docker build --tag ${IMAGE} . | |
docker push ${IMAGE} | |
deploy-dev: | |
name: Deploy til dev | |
runs-on: ubuntu-latest | |
needs: bygg | |
steps: | |
- name: Sjekk ut kode | |
uses: actions/checkout@v3 | |
- name: Deploy til dev-gcp | |
uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: dev-gcp | |
RESOURCE: .nais/nais.yml,.nais/alertsNy.yml,.nais/alertsTesting.yml,.nais/unleash-apitoken.yml | |
VARS: .nais/dev.yml | |
PRINT_PAYLOAD: true | |
deploy-prod: | |
name: Deploy til prod | |
runs-on: ubuntu-latest | |
needs: bygg | |
steps: | |
- name: Sjekk ut kode | |
uses: actions/checkout@v3 | |
- name: Deploy til prod-gcp | |
uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: prod-gcp | |
RESOURCE: .nais/nais.yml,.nais/alertsNy.yml,.nais/unleash-apitoken.yml | |
VARS: .nais/prod.yml | |
PRINT_PAYLOAD: true | |
deploy-dev-gcp-labs: | |
name: Deploy til dev-gcp (tidligere labs) | |
runs-on: ubuntu-latest | |
needs: bygg | |
steps: | |
- name: Sjekk ut kode | |
uses: actions/checkout@v3 | |
- name: Generer tiltak-refusjon-api-wiremock configmap | |
run: | | |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" | |
chmod +x ./kubectl | |
./kubectl create configmap --dry-run=client -o yaml --from-file src/test/resources/mappings -n arbeidsgiver tiltak-refusjon-api-wiremock > .nais/wiremock-mappings.yml | |
cat .nais/wiremock-mappings.yml # debug | |
- name: Deploy til dev-gcp | |
uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: dev-gcp | |
RESOURCE: .nais/dev-gcp-labs.yml,.nais/wiremock.yml,.nais/wiremock-mappings.yml | |
VAR: deploytrigger=${{ github.run_number }} | |
PRINT_PAYLOAD: true |