|
| 1 | +name: Build and Push Images to GitHub Container Registry |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - develop-saas |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-and-push: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + environment: Build |
| 12 | + |
| 13 | + permissions: |
| 14 | + contents: read |
| 15 | + packages: write |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout code |
| 19 | + uses: actions/checkout@v3 |
| 20 | + |
| 21 | + - name: Set up Docker Buildx |
| 22 | + uses: docker/setup-buildx-action@v2 |
| 23 | + |
| 24 | + - name: Debug GitHub Token Access |
| 25 | + run: | |
| 26 | + if [ -z "${{ secrets.GITHUB_TOKEN }}" ]; then |
| 27 | + echo "GITHUB_TOKEN is NOT available" |
| 28 | + exit 1 |
| 29 | + else |
| 30 | + echo "GITHUB_TOKEN is available" |
| 31 | + fi |
| 32 | +
|
| 33 | + - name: Log in to GitHub Container Registry |
| 34 | + uses: docker/login-action@v3 |
| 35 | + with: |
| 36 | + registry: ghcr.io |
| 37 | + username: ${{ github.actor }} |
| 38 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 39 | + |
| 40 | + - name: Verify Google Client ID Secret |
| 41 | + run: | |
| 42 | + if [ -z "${{ secrets.GOOGLE_CLIENT_ID }}" ]; then |
| 43 | + echo "GOOGLE_CLIENT_ID secret is NOT available" |
| 44 | + exit 1 |
| 45 | + fi |
| 46 | +
|
| 47 | + - name: Build and push Clients image |
| 48 | + uses: docker/build-push-action@v4 |
| 49 | + with: |
| 50 | + context: ./Clients |
| 51 | + platforms: linux/amd64,linux/arm64 |
| 52 | + push: true |
| 53 | + tags: | |
| 54 | + ghcr.io/${{ github.repository_owner }}/verifywise-frontend-saas:test |
| 55 | + build-args: | |
| 56 | + VITE_GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }} |
| 57 | +
|
| 58 | + - name: Build and push Servers image |
| 59 | + uses: docker/build-push-action@v4 |
| 60 | + with: |
| 61 | + context: ./Servers |
| 62 | + platforms: linux/amd64,linux/arm64 |
| 63 | + push: true |
| 64 | + tags: | |
| 65 | + ghcr.io/${{ github.repository_owner }}/verifywise-backend-saas:test |
| 66 | +
|
| 67 | + - name: Build and push BiasAndFairnessServers image |
| 68 | + uses: docker/build-push-action@v4 |
| 69 | + with: |
| 70 | + context: ./BiasAndFairnessServers |
| 71 | + platforms: linux/amd64,linux/arm64 |
| 72 | + push: true |
| 73 | + tags: | |
| 74 | + ghcr.io/${{ github.repository_owner }}/verifywise-bias-and-fairness-backend-saas:test |
| 75 | +
|
| 76 | + - name: Deploy to Testing |
| 77 | + uses: appleboy/ssh-action@v0.1.5 |
| 78 | + with: |
| 79 | + host: ${{ secrets.TEST_HOST }} |
| 80 | + username: ${{ secrets.TEST_USER }} |
| 81 | + key: ${{ secrets.TEST_SSH_KEY }} |
| 82 | + script: | |
| 83 | + cd /root/verifywise |
| 84 | + docker-compose --env-file .env.prod down |
| 85 | + docker images --format "table {{.Repository}}:{{.Tag}}\t{{.ID}}" | grep -v -E "(redis|postgres)" | awk 'NR>1 {print $2}' | xargs -r docker rmi -f || true |
| 86 | + ./install.sh |
0 commit comments