Skip to content

Deploy ecamp3-logging #3

Deploy ecamp3-logging

Deploy ecamp3-logging #3

name: Deploy ecamp3-logging
on:
workflow_dispatch:
inputs:
environment:
description: 'Choose environment'
type: environment
required: true
jobs:
deploy-ecamp3-logging:
name: "Deploy ecamp3-logging"
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
steps:
- name: Validate environment
uses: actions/github-script@v7
with:
script: |
if (!"${{ github.event.inputs.environment }}".startsWith("ecamp3-logging")) {
throw new Error("Environment must start with 'ecamp3-logging'");
}
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Dump secrets to .env
run: |
echo '${{ toJSON(secrets) }}' | jq -r 'keys[] as $k | select(.[$k] |contains("\n") | not) | "\($k)=\"\(.[$k])\""' >> .env
working-directory: .ops/ecamp3-logging
- name: Dump variables to .env
run: |
echo '${{ toJSON(vars) }}' | jq -r 'keys[] as $k | select(.[$k] |contains("\n") | not) | "\($k)=\"\(.[$k])\""' >> .env
working-directory: .ops/ecamp3-logging
- name: Show .env for debugging
run: echo "$(cat .env | sort)"
working-directory: .ops/ecamp3-logging
- name: Setup helm
run: |
mkdir ~/.kube && echo '${{ secrets.KUBECONFIG }}' > ~/.kube/config && chmod go-r ~/.kube/config
- name: Add helm repositories
run: |
helm repo add fluent https://fluent.github.io/helm-charts
helm repo update
- name: Diff deployment
run: |
./deploy.sh diff || true
working-directory: .ops/ecamp3-logging
- name: Show values.out.yaml
run: cat values.out.yaml
working-directory: .ops/ecamp3-logging
- name: Deploy
run: |
./deploy.sh deploy
working-directory: .ops/ecamp3-logging