Deploy Staging #636
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: Deploy Staging | |
| on: | |
| push: | |
| branches: | |
| - hetzner/staging | |
| schedule: | |
| - cron: '0 7 * * *' | |
| concurrency: | |
| group: deploy-frontend-staging | |
| cancel-in-progress: false | |
| env: | |
| ANSIBLE_FORCE_COLOR: true | |
| TARGET_PLATFORMS: linux/arm64 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Clone Commercial Backend | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: DashHub-ai/Dashhub-Commercial-Backend | |
| token: ${{ secrets.GIT_CLONE_ACCESS_TOKEN }} | |
| path: apps/backend/src/commercial | |
| - name: Clone Commercial Frontend | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: DashHub-ai/Dashhub-Commercial-Frontend | |
| token: ${{ secrets.GIT_CLONE_ACCESS_TOKEN }} | |
| path: apps/chat/src/commercial | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci --prefer-offline --no-audit | |
| - name: Turbo Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: .turbo | |
| key: turbo-build-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }} | |
| restore-keys: | | |
| turbo-build-${{ github.job }}-${{ github.ref_name }}- | |
| - name: Build packages | |
| run: npm run build | |
| env: | |
| NODE_ENV: production | |
| PUBLIC_VITE_APP_ENV: staging | |
| PUBLIC_VITE_API_URL: https://dev.dashhub.ai/api | |
| PUBLIC_VITE_GOOGLE_DRIVE_CLIENT_ID: ${{ secrets.GOOGLE_DRIVE_CLIENT_ID }} | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: staging-build-artifacts | |
| overwrite: true | |
| retention-days: 1 | |
| path: | | |
| apps/*/dist | |
| packages/*/dist | |
| deploy-docker-images: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| app: | |
| - name: backend | |
| context: apps/backend | |
| - name: chat | |
| context: apps/chat | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: staging-build-artifacts | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: dev.dashhub.ai | |
| username: ${{ secrets.STAGING_PODMAN_REGISTRY_USERNAME }} | |
| password: ${{ secrets.STAGING_PODMAN_REGISTRY_PASSWORD }} | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: ${{ matrix.app.context }} | |
| push: true | |
| tags: | | |
| dev.dashhub.ai/dashhub-${{ matrix.app.name }}:latest | |
| dev.dashhub.ai/dashhub-${{ matrix.app.name }}:${{ github.sha }} | |
| platforms: ${{ env.TARGET_PLATFORMS }} | |
| cache-from: type=gha,scope=${{ matrix.app.name }} | |
| cache-to: type=gha,scope=${{ matrix.app.name }},mode=max |