girouette customization feature #768
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: Deployment | |
| on: | |
| push: | |
| branches: ['main'] | |
| paths: | |
| - apps/client/**/* | |
| - apps/server/**/* | |
| - docker/**/* | |
| - libraries/**/* | |
| - scripts/**/* | |
| - package.json | |
| - pnpm-lock.yaml | |
| - pnpm-workspace.yaml | |
| - .dockerignore | |
| - .github/workflows/deployment.yaml | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| strategy: | |
| matrix: | |
| component: ['client', 'server'] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| - name: Copy environment files | |
| run: | | |
| echo "${{ secrets.CLIENT_ENV }}" > apps/client/.env | |
| echo "${{ secrets.SERVER_ENV }}" > apps/server/.env | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.component }} | |
| tags: type=sha,format=long | |
| - name: Generate build information | |
| id: build-info | |
| run: | | |
| echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "build_time=$(date +'%Y-%m-%dT%H:%M:%S%:z')" >> $GITHUB_OUTPUT | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf | |
| with: | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| BUILD_HASH=${{ steps.build-info.outputs.short_sha }} | |
| BUILD_TIMESTAMP=${{ steps.build-info.outputs.build_time }} | |
| secrets: | | |
| posthog_cli_api_key=${{ secrets.POSTHOG_CLI_API_KEY }} | |
| posthog_cli_project_id=${{ secrets.POSTHOG_CLI_PROJECT_ID }} | |
| posthog_cli_host=${{ secrets.POSTHOG_CLI_HOST }} | |
| context: . | |
| file: docker/Dockerfile-${{ matrix.component }} | |
| # platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: ['build'] | |
| permissions: | |
| contents: read | |
| packages: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| - name: Deploy stack to the server | |
| uses: kitconcept/docker-stack-deploy@1a7a5e778d08cf92bda2ebbd068fe0ca078d09c8 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| remote_host: ${{ secrets.DEPLOY_SSH_HOST }} | |
| remote_port: ${{ secrets.DEPLOY_SSH_PORT }} | |
| remote_user: ${{ secrets.DEPLOY_SSH_USER }} | |
| remote_private_key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} | |
| stack_file: "docker/bus-tracker-stack.yaml" | |
| stack_name: "bus-tracker" |