Fjerner "team" under spec i nais fil #271
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: Build, push, and deploy | |
on: | |
workflow_dispatch: | |
push: | |
paths-ignore: | |
- 'alerts.yaml' | |
- '.github/workflows/alerts.yml' | |
pull_request: | |
paths-ignore: | |
- 'alerts.yaml' | |
- '.github/workflows/alerts.yml' | |
env: | |
IMAGE: ghcr.io/${{ github.repository }}/altinn-admin:${{ github.sha }} | |
jobs: | |
test: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: '11.x' | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('build.gradle') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-cache- | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-wrapper- | |
- name: Build and run tests | |
run: ./gradlew clean build | |
build: | |
name: Build and push Docker container | |
needs: test | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: '11.x' | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('build.gradle') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-cache- | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-wrapper- | |
- name: Build JAR | |
run: ./gradlew clean build shadowJar -x test | |
- name: Build and publish Docker image | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
docker build . --pull --tag ${IMAGE} | |
echo "$GITHUB_TOKEN" | docker login ghcr.io --username "$GITHUB_REPOSITORY" --password-stdin | |
docker push ${IMAGE} | |
deploy-dev: | |
name: Deploy to dev fss | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: dev-fss | |
RESOURCE: .nais/naiserator.yaml | |
VARS: .nais/config-dev.yaml | |
deploy-dev-gcp: | |
name: Deploy to dev gcp | |
needs: deploy-dev | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: dev-gcp | |
RESOURCE: .nais/naiserator-gcp.yaml | |
VARS: .nais/config-dev-gcp.yaml | |
deploy-prod: | |
name: Deploy to prod fss | |
needs: deploy-dev | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: prod-fss | |
RESOURCE: .nais/naiserator.yaml | |
VARS: .nais/config-prod.yaml |