Build and deploy production landing page and language tour #23
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 and deploy production landing page and language tour | |
| on: workflow_dispatch | |
| env: | |
| REGISTRY: ghcr.io | |
| ORG_NAME: software-mansion | |
| REPO_NAME: ${{ github.repository }} | |
| jobs: | |
| build_docker_images: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: "false" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log into registry ${{ env.REGISTRY }} | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ${{ env.REGISTRY }}/${{ env.ORG_NAME }}/popcorn-base | |
| ${{ env.REGISTRY }}/${{ env.ORG_NAME }}/popcorn-landing | |
| ${{ env.REGISTRY }}/${{ env.ORG_NAME }}/popcorn-langtour | |
| - name: Build base Docker image | |
| id: build-base | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./base.Dockerfile | |
| build-args: | | |
| COMMIT_REF=${{ github.sha }} | |
| push: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| tags: "${{ env.REGISTRY }}/${{ env.ORG_NAME }}/popcorn-base:latest" | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build landing Docker image | |
| id: build-and-push-landing | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./landing.Dockerfile | |
| push: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| tags: "${{ env.REGISTRY }}/${{ env.ORG_NAME }}/popcorn-landing:latest" | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build language tour Docker image | |
| id: build-and-push-langtour | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./langtour.Dockerfile | |
| # Sentry DSN is embedded in built JS, not really a secret | |
| build-args: | | |
| SENTRY_DSN=${{ secrets.SENTRY_CLIENT_DSN }} | |
| SENTRY_MODE=production | |
| push: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| tags: "${{ env.REGISTRY }}/${{ env.ORG_NAME }}/popcorn-langtour:latest" | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| deploy_production: | |
| runs-on: ubuntu-latest | |
| needs: build_docker_images | |
| steps: | |
| - name: Deploy to production | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.POPCORN_HOSTS }} | |
| username: ${{ secrets.POPCORN_USER }} | |
| key: ${{ secrets.POPCORN_SSH_PRIV }} | |
| port: ${{ secrets.POPCORN_PORT }} | |
| script: | | |
| docker compose -f popcorn-landing.yml -p landing up -d | |
| docker compose -f elixir-langtour.yml -p langtour up -d |