fix: add misisng repo helm chart #25
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: Develop Images | |
| on: | |
| push: | |
| branches: | |
| - "dev/**" | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract branch tag | |
| id: tag | |
| run: | | |
| BRANCH=${{ github.ref_name }} | |
| if [[ ! "$BRANCH" =~ ^dev/ ]]; then | |
| echo "Branch não é do tipo dev/*. Saindo." | |
| exit 1 | |
| fi | |
| TAG="${BRANCH/dev\//}" | |
| echo "tag=v${TAG}" >> $GITHUB_OUTPUT | |
| echo "BRANCH=$BRANCH" >> $GITHUB_OUTPUT | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=raw,value=${{ steps.tag.outputs.tag }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| file: ./Dockerfile | |
| target: production | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64 | |
| helm-test: | |
| runs-on: ubuntu-latest | |
| needs: docker | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract branch tag | |
| id: tag | |
| run: | | |
| BRANCH=${{ github.ref_name }} | |
| TAG="${BRANCH/dev\//}" | |
| echo "tag=v${TAG}" >> $GITHUB_OUTPUT | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4 | |
| with: | |
| version: "v3.16.0" | |
| - name: Create kind cluster | |
| uses: helm/kind-action@v1.10.0 | |
| with: | |
| cluster_name: mapas-test | |
| config: .github/kind-config.yaml | |
| - name: Load Docker image into kind | |
| run: | | |
| TAG="${{ steps.tag.outputs.tag }}" | |
| REPO="${{ github.repository }}" | |
| REPO_LOWER=$(echo "$REPO" | tr '[:upper:]' '[:lower:]') | |
| docker pull ghcr.io/${REPO_LOWER}:${TAG} | |
| kind load docker-image ghcr.io/${REPO_LOWER}:${TAG} --name mapas-test | |
| - name: Add helm repositories | |
| run: helm repo add groundhog2k https://groundhog2k.github.io/helm-charts/ | |
| - name: Build helm chart dependencies | |
| run: helm dependency build helm/mapas | |
| - name: Install helm chart | |
| run: | | |
| TAG="${{ steps.tag.outputs.tag }}" | |
| REPO="${{ github.repository }}" | |
| REPO_LOWER=$(echo "$REPO" | tr '[:upper:]' '[:lower:]') | |
| helm install mapas helm/mapas \ | |
| --namespace mapas-test \ | |
| --create-namespace \ | |
| --set image.repository=ghcr.io/${REPO_LOWER} \ | |
| --set image.tag=${TAG} \ | |
| --set postgresql.enabled=true \ | |
| --set 'redis-cache.enabled=false' \ | |
| --set 'redis-sessions.enabled=false' \ | |
| --set mapas.appEnv=development \ | |
| --set mapas.appDebug=true \ | |
| --set-json mapas.extraEnv='[{"name":"MAPASCULTURAIS_SKIP_DB_INIT","value":"true"}]' \ | |
| --wait \ | |
| --timeout 5m | |
| - name: Verify deployment | |
| run: | | |
| kubectl get pods -n mapas-test | |
| kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=mapas -n mapas-test --timeout 2m |