name: Build and Publish on: release: types: [created] jobs: build: name: Build runs-on: ubuntu-latest permissions: contents: read packages: write steps: - 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.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push the Docker image uses: docker/build-push-action@v6 with: push: true tags: | ghcr.io/project-optima/ttscm-api:latest ghcr.io/project-optima/ttscm-api:${{ github.event.release.tag_name }} deploy: name: Deploy needs: [build] runs-on: ubuntu-latest steps: - name: Set the Kubernetes context uses: azure/k8s-set-context@v2 with: method: kubeconfig kubeconfig: ${{ secrets.KUBECONFIG }} - name: Checkout source code uses: actions/checkout@v4 - name: Lint Kubernetes manifests uses: azure/k8s-lint@v1 with: lintType: dryrun manifests: | kubernetes/deployment.yaml namespace: optima - name: Deploy to the Kubernetes cluster uses: azure/k8s-deploy@v5 with: namespace: optima force: true skip-tls-verify: true manifests: | kubernetes/deployment.yaml images: | ghcr.io/project-optima/ttscm-api:${{ github.event.release.tag_name }}