Dev deploy of test_branch #136
Workflow file for this run
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: Manual deploy to dev | |
on: | |
workflow_call: | |
secrets: | |
NAIS_WORKLOAD_IDENTITY_PROVIDER: | |
description: "Identity provider for nais/docker-build-push" | |
required: true | |
workflow_dispatch: | |
run-name: Dev deploy of ${{ github.ref_name }} | |
jobs: | |
build: | |
name: Build | |
permissions: | |
contents: read | |
id-token: write | |
outputs: | |
image: ${{ steps.docker-build-push.outputs.image }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Install Java 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: temurin | |
- name: Test and build | |
run: ./gradlew test bootJar | |
env: | |
ORG_GRADLE_PROJECT_githubUser: x-access-token | |
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build & push Docker image | |
uses: nais/docker-build-push@v0 | |
id: docker-build-push | |
with: | |
team: klage # required | |
tag: ${{ github.sha }} # optional | |
push_image: true # optional, default true | |
dockerfile: Dockerfile # optional, default Dockerfile | |
docker_context: . # optional, default . | |
image_suffix: # optional, default empty | |
cache_from: type=gha # optional, default type=gha | |
cache_to: type=gha,mode=max # optional, default type=gha,mode=max | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} # required, but is defined as an organization secret | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} # required, but is defined as an organization variable | |
build_args: | | |
VERSION=${CI} | |
- name: Post failures to Slack | |
if: failure() | |
run: | | |
curl -X POST --data-urlencode "payload={\"channel\": \"$CHANNEL\", \"text\": \"$MESSAGE\", \"icon_emoji\": \":ghost:\"}" $WEBHOOK_URL | |
env: | |
MESSAGE: "Bygg feilet" | |
CHANNEL: "#klage-notifications" | |
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }} | |
deploy_to_dev: | |
name: Deploy | |
needs: build | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout code | |
- name: Deploy to dev | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
TEAM: klage | |
CLUSTER: dev-gcp | |
VARS: deploy/dev.yaml | |
RESOURCE: deploy/nais.yaml | |
VAR: image=${{ needs.build.outputs.image }} | |
IMAGE: ${{ needs.build.outputs.image }} | |
- name: Post failures to Slack | |
if: failure() | |
run: | | |
curl -X POST --data-urlencode "payload={\"channel\": \"$CHANNEL\", \"text\": \"$MESSAGE\", \"icon_emoji\": \":ghost:\"}" $WEBHOOK_URL | |
env: | |
MESSAGE: "Deploy til dev feilet" | |
CHANNEL: "#klage-notifications" | |
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }} |