web(paywall): swap hero icon to transparent variant #45
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: Build & Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| OWNER: ${{ github.repository_owner }} | |
| IMAGE_PREFIX: sna_net | |
| jobs: | |
| build: | |
| name: Build & push images | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| service: | |
| - { name: backend, context: ./backend, dockerfile: ./backend/Dockerfile } | |
| - { name: llm_service, context: ./llm_service, dockerfile: ./llm_service/Dockerfile } | |
| - { name: frontend, context: ./frontend, dockerfile: ./frontend/Dockerfile } | |
| - { name: landing, context: ./landing, dockerfile: ./landing/Dockerfile } | |
| - { name: bot_auth, context: ./bot_auth, dockerfile: ./bot_auth/Dockerfile } | |
| - { name: xray_proxy, context: ./xray_proxy, dockerfile: ./xray_proxy/Dockerfile } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Compute image meta | |
| id: meta | |
| run: | | |
| OWNER_LC=$(echo "${{ env.OWNER }}" | tr '[:upper:]' '[:lower:]') | |
| IMAGE="${REGISTRY}/${OWNER_LC}/${IMAGE_PREFIX}-${{ matrix.service.name }}" | |
| SHA_TAG="main-$(echo ${{ github.sha }} | cut -c1-7)" | |
| echo "image=$IMAGE" >> $GITHUB_OUTPUT | |
| echo "sha_tag=$SHA_TAG" >> $GITHUB_OUTPUT | |
| - name: Build & push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ${{ matrix.service.context }} | |
| file: ${{ matrix.service.dockerfile }} | |
| push: true | |
| tags: | | |
| ${{ steps.meta.outputs.image }}:latest | |
| ${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.sha_tag }} | |
| cache-from: type=gha,scope=${{ matrix.service.name }} | |
| cache-to: type=gha,scope=${{ matrix.service.name }},mode=max | |
| build-args: | | |
| VITE_API_BASE_URL=https://api.innercore.art | |
| VITE_APP_VERSION=0.4.2 | |
| VITE_GOOGLE_CLIENT_ID=${{ secrets.VITE_GOOGLE_CLIENT_ID }} | |
| deploy: | |
| name: Deploy to msk-1 | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Compute tag | |
| id: tag | |
| run: echo "sha_tag=main-$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT | |
| - name: Setup SSH | |
| uses: webfactory/ssh-agent@v0.9.0 | |
| with: | |
| ssh-private-key: ${{ secrets.MSK1_SSH_KEY }} | |
| - name: Add server to known_hosts | |
| run: | | |
| mkdir -p ~/.ssh | |
| ssh-keyscan -p ${{ secrets.MSK1_SSH_PORT }} -H ${{ secrets.MSK1_SSH_HOST }} >> ~/.ssh/known_hosts | |
| - name: Sync deploy artifacts (compose, Caddyfile, deploy.sh, xray-proxy.json) | |
| run: | | |
| scp -P ${{ secrets.MSK1_SSH_PORT }} \ | |
| deploy/docker-compose.prod.yml \ | |
| deploy/Caddyfile \ | |
| deploy/deploy.sh \ | |
| deploy/xray-proxy.json \ | |
| ${{ secrets.MSK1_SSH_USER }}@${{ secrets.MSK1_SSH_HOST }}:~/innercore/deploy/ | |
| ssh -p ${{ secrets.MSK1_SSH_PORT }} \ | |
| ${{ secrets.MSK1_SSH_USER }}@${{ secrets.MSK1_SSH_HOST }} \ | |
| "chmod +x ~/innercore/deploy/deploy.sh" | |
| - name: Run deploy | |
| env: | |
| IMAGE_TAG: ${{ steps.tag.outputs.sha_tag }} | |
| run: | | |
| ssh -p ${{ secrets.MSK1_SSH_PORT }} \ | |
| ${{ secrets.MSK1_SSH_USER }}@${{ secrets.MSK1_SSH_HOST }} \ | |
| "cd ~/innercore/deploy && IMAGE_TAG=$IMAGE_TAG GHCR_USER=${{ github.actor }} GHCR_TOKEN=${{ secrets.GHCR_DEPLOY_TOKEN }} ./deploy.sh" |