update-vela-studio-dev #203
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 Studio | |
| on: | |
| repository_dispatch: | |
| types: [update-vela-studio, update-vela-studio-dev] | |
| jobs: | |
| deploy-studio: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| environment: "${{ (github.event.action == 'update-vela-studio-dev') && 'dev' || 'prod' }}" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.action == 'update-vela-studio-dev' && 'dev' || github.event.repository.default_branch }} | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4 | |
| - name: Set image metadata | |
| id: meta | |
| env: | |
| PAYLOAD_TAG: ${{ github.event.client_payload.sha }} | |
| run: | | |
| SHORT_SHA="${PAYLOAD_TAG::7}" | |
| echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT" | |
| echo "latest_tag=latest-${SHORT_SHA}" >> "$GITHUB_OUTPUT" | |
| echo "dev_tag=dev-${SHORT_SHA}" >> "$GITHUB_OUTPUT" | |
| - name: Write kubeconfig | |
| # Instructions for generating the KUBECONFIG secret live in docs/service-account-kubeconfig.md | |
| id: kubeconfig | |
| env: | |
| KUBE_CONFIG_DATA: ${{ secrets.KUBECONFIG }} | |
| run: | | |
| if [[ -z "$KUBE_CONFIG_DATA" ]]; then | |
| echo "KUBECONFIG secret is not set" >&2 | |
| exit 1 | |
| fi | |
| echo "$KUBE_CONFIG_DATA" | base64 --decode > kubeconfig.yaml 2>/dev/null || echo "$KUBE_CONFIG_DATA" > kubeconfig.yaml | |
| chmod 600 kubeconfig.yaml | |
| echo "path=$PWD/kubeconfig.yaml" >> "$GITHUB_OUTPUT" | |
| - name: Deploy Studio | |
| env: | |
| KUBECONFIG: ${{ steps.kubeconfig.outputs.path }} | |
| IMAGE_TAG: ${{ github.event.action == 'update-vela-studio-dev' && steps.meta.outputs.dev_tag || steps.meta.outputs.latest_tag }} | |
| run: | | |
| helm upgrade --install vela ./chart \ | |
| --namespace vela \ | |
| --create-namespace \ | |
| --reuse-values \ | |
| --set-string studio.image.tag="${IMAGE_TAG}" |