Deploy ops-dashboard #28
This file contains hidden or 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: Deploy ops-dashboard | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: "Choose environment" | |
| type: environment | |
| required: true | |
| action: | |
| description: "Choose action" | |
| type: choice | |
| required: true | |
| default: diff | |
| options: | |
| - diff | |
| - deploy | |
| jobs: | |
| deploy-ops-dashboard: | |
| name: "Deploy ops-dashboard" | |
| runs-on: ubuntu-latest | |
| environment: ${{ github.event.inputs.environment }} | |
| steps: | |
| - name: Validate environment | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| if (!"${{ github.event.inputs.environment }}".startsWith("ops-dashboard")) { | |
| throw new Error("Environment must start with 'ops-dashboard'"); | |
| } | |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6 | |
| - name: Dump secrets to /tmp/secrets.yaml | |
| run: | | |
| cat << 'EOF' | tee -a /tmp/secrets.yaml | |
| ${{ toJSON(secrets) }} | |
| EOF | |
| jq '.' /tmp/secrets.yaml | |
| - name: Dump variables to /tmp/env.yaml | |
| run: | | |
| cat << 'EOF' | tee -a /tmp/env.yaml | |
| ${{ toJSON(vars) }} | |
| EOF | |
| jq '.' /tmp/env.yaml | |
| - name: Merge secrets and variables | |
| run: | | |
| jq -s '.[0] + .[1]' /tmp/secrets.yaml /tmp/env.yaml > env.yaml | |
| jq '.' env.yaml | |
| working-directory: .ops/ops-dashboard | |
| - name: pin helm to correct version | |
| run: | | |
| helm version | |
| curl -o /tmp/helm.tar.gz -sL https://get.helm.sh/helm-v4.0.1-linux-amd64.tar.gz | |
| echo "e0365548f01ed52a58a1181ad310b604a3244f59257425bb1739499372bdff60 /tmp/helm.tar.gz" | sha256sum --check | |
| tar -xzf /tmp/helm.tar.gz -C /tmp/ | |
| mv /tmp/linux-amd64/helm /usr/local/bin/helm | |
| chmod +x /usr/local/bin/helm | |
| helm version | |
| - name: Setup helm | |
| run: | | |
| mkdir ~/.kube && echo '${{ secrets.KUBECONFIG }}' > ~/.kube/config && chmod go-r ~/.kube/config | |
| - uses: ./.github/actions/setup-helmfile | |
| - name: Diff deployment | |
| run: | | |
| ./deploy.sh diff || true | |
| working-directory: .ops/ops-dashboard | |
| - name: Show values.yaml | |
| run: cat values.yaml | |
| working-directory: .ops/ops-dashboard | |
| - name: Deploy | |
| if: ${{ github.event.inputs.action == 'deploy' }} | |
| run: | | |
| ./deploy.sh deploy | |
| working-directory: .ops/ops-dashboard |