fix(cicd): rename secret #19
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: ["main", "rewrite"] | |
| jobs: | |
| build-frontend: | |
| name: Build & Push Frontend Image | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ vars.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build Docker image | |
| uses: docker/bake-action@v6 | |
| env: | |
| GRAPHQL_GITHUB_API_TOKEN: ${{ secrets.GRAPHQL_GITHUB_API_TOKEN }} | |
| with: | |
| files: | | |
| docker-bake.hcl | |
| docker-bake.prod.hcl | |
| push: true | |
| no-cache: true | |
| targets: frontend | |
| build-backend: | |
| name: Build & Push Backend Image | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ vars.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build Docker image | |
| uses: docker/bake-action@v6 | |
| env: | |
| GRAPHQL_GITHUB_API_TOKEN: ${{ secrets.GRAPHQL_GITHUB_API_TOKEN }} | |
| with: | |
| files: | | |
| docker-bake.hcl | |
| docker-bake.prod.hcl | |
| push: true | |
| no-cache: true | |
| targets: backend | |
| deploy: | |
| name: Deploy Stack | |
| runs-on: ubuntu-latest | |
| environment: production | |
| needs: [build-frontend, build-backend] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Setup Docker context | |
| uses: arwynfr/actions-docker-context@v2 | |
| with: | |
| docker_host: ssh://${{ vars.REMOTE_USER }}@${{ secrets.REMOTE_HOST }} | |
| context_name: prod-remote-context | |
| ssh_key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| use_context: true | |
| - name: Set up SSH key | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts | |
| - name: Deploy stack | |
| uses: hoverkraft-tech/compose-action@v2 | |
| with: | |
| compose-file: | | |
| ./compose.yaml | |
| ./compose.prod.yaml | |
| env: | |
| CF_TURNSTILE_SECRET: ${{ secrets.CF_TURNSTILE_SECRET }} | |
| KVP_REDACTED_TERMS: ${{ secrets.REDACTED_TERMS }} |