Something went wrong. Try again.
AtAuth
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485name: Deploy ATAuth to DO# CI/CD: Gitea Actions → DO managed k8s
on: push: branches: [main] paths-ignore: - '*.md' - 'docs/**'
env: REGISTRY: registry.digitalocean.com/ghostmesh-registry IMAGE_NAME: atauth DEPLOYMENT: atauth NAMESPACE: atauth
jobs: test: name: Test Gateway runs-on: ubuntu-latest defaults: run: working-directory: gateway steps: - name: Checkout code uses: actions/checkout@v4
- name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20'
- name: Install dependencies run: npm ci
- name: Type check run: npm run typecheck
- name: Lint run: npm run lint
- name: Run tests run: npm run test:run
build-and-deploy: name: Build, Push, Deploy runs-on: host needs: [test] steps: - name: Checkout code uses: actions/checkout@v4
- name: Set short SHA id: sha run: echo "short=$(echo ${{ github.sha }} | cut -c1-7)" >> "$GITHUB_OUTPUT"
- name: Login to DO Container Registry run: echo "${{ secrets.DO_REGISTRY_TOKEN }}" | docker login registry.digitalocean.com -u "${{ secrets.DO_REGISTRY_TOKEN }}" --password-stdin
- name: Build Docker image run: | docker build \ --platform linux/amd64 \ -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.sha.outputs.short }} \ -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ gateway/
- name: Push Docker image run: | docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.sha.outputs.short }} docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- name: Deploy to DO Kubernetes run: | echo "${{ secrets.DO_KUBECONFIG }}" | base64 -d > /tmp/kubeconfig KUBECONFIG=/tmp/kubeconfig kubectl rollout restart deployment/${{ env.DEPLOYMENT }} -n ${{ env.NAMESPACE }} KUBECONFIG=/tmp/kubeconfig kubectl rollout status deployment/${{ env.DEPLOYMENT }} -n ${{ env.NAMESPACE }} --timeout=120s rm -f /tmp/kubeconfig
- name: Clean up Docker images if: always() run: | docker rmi ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.sha.outputs.short }} 2>/dev/null || true docker rmi ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest 2>/dev/null || true