feat: extra outer core projects supported #190
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 to Droplet | |
| on: | |
| push: | |
| branches: [v2-nextjs] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: julesrb/transcript42 | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| environment: main | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./transcript42 | |
| push: true | |
| tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
| build-args: | | |
| NEXT_PUBLIC_FORTYTWO_UID=${{ secrets.NEXT_PUBLIC_FORTYTWO_UID }} | |
| NEXT_PUBLIC_OAUTH_REDIRECT_URI=${{ secrets.NEXT_PUBLIC_OAUTH_REDIRECT_URI }} | |
| NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=${{ secrets.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY }} | |
| NEXT_PUBLIC_APP_URL=${{ secrets.NEXT_PUBLIC_APP_URL }} | |
| env: | |
| NEXT_PUBLIC_FORTYTWO_UID: ${{ secrets.NEXT_PUBLIC_FORTYTWO_UID }} | |
| NEXT_PUBLIC_OAUTH_REDIRECT_URI: ${{ secrets.NEXT_PUBLIC_OAUTH_REDIRECT_URI }} | |
| NEXT_PUBLIC_GOOGLE_MAPS_API_KEY: ${{ secrets.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY }} | |
| NEXT_PUBLIC_APP_URL: ${{ secrets.NEXT_PUBLIC_APP_URL }} | |
| deploy: | |
| needs: build-and-push | |
| runs-on: ubuntu-latest | |
| environment: main | |
| steps: | |
| - name: Set up SSH | |
| uses: webfactory/ssh-agent@v0.9.0 | |
| with: | |
| ssh-private-key: ${{ secrets.DROPLET_SSH_KEY }} | |
| - name: Deploy via SSH | |
| run: | | |
| ssh -o StrictHostKeyChecking=no ${{ secrets.DROPLET_USER }}@${{ secrets.DROPLET_HOST }} " | |
| mkdir -p /var/www/pdf-service && | |
| cd /var/www/pdf-service && | |
| # Pull latest code for the compose file | |
| if [ ! -d .git ]; then | |
| git clone https://github.com/${{ github.repository }}.git . | |
| fi && | |
| git fetch origin && | |
| git reset --hard origin/v2-nextjs && | |
| # Login to registry on the droplet | |
| echo ${{ secrets.GITHUB_TOKEN }} | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin && | |
| # Pull and Restart with the new image | |
| export DOCKER_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest && | |
| docker compose pull && | |
| docker compose up -d | |
| " |