Something went wrong. Try again.
AtAuth
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384name: Deploy ATAuth to DO
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