|
| 1 | +name: Immich Setup & Verification |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + K_SECONDS: |
| 8 | + description: 'Duration in seconds to sleep before verification' |
| 9 | + required: true |
| 10 | + default: '90' # Immich can take a bit longer to fully initialize |
| 11 | + type: string |
| 12 | + |
| 13 | +jobs: |
| 14 | + setup_and_verify_immich: |
| 15 | + runs-on: ubuntu-24.04 # Specifies the base Ubuntu 24.04 image |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout Repository |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Install Docker and Docker Compose |
| 22 | + uses: docker/setup-buildx-action@v3 # This action conveniently installs Docker and Docker Compose v2 (docker compose) |
| 23 | + |
| 24 | + - name: Log in to GitHub Container Registry (GHCR) |
| 25 | + # Use the built-in GITHUB_TOKEN to authenticate with GHCR |
| 26 | + # This is essential for pulling images from ghcr.io if rate limited or private |
| 27 | + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password --stdin |
| 28 | + |
| 29 | + - name: Start Immich services |
| 30 | + # Change working-directory to where your docker-compose.yml and .env are located |
| 31 | + working-directory: docker-configs/immich |
| 32 | + run: | |
| 33 | + echo "Starting Immich services with docker compose from $(pwd)..." |
| 34 | + # Ensure volumes are created if not already |
| 35 | + docker compose pull # Pull images first to ensure they are the specified version |
| 36 | + docker compose up -d |
| 37 | +
|
| 38 | + - name: Wait for Immich to fully initialize |
| 39 | + run: | |
| 40 | + K_SECONDS="${{ github.event.inputs.K_SECONDS }}" |
| 41 | + echo "Sleeping for $K_SECONDS seconds before verification..." |
| 42 | + sleep "$K_SECONDS" |
| 43 | + echo "Sleep finished, proceeding to verification." |
| 44 | +
|
| 45 | + - name: Verify Immich API is up and running |
| 46 | + run: | |
| 47 | + echo "Verifying Immich API..." |
| 48 | + # The API server runs on IMMICH_SERVER_PORT (2283 by default) as defined in .env |
| 49 | + curl -f -s http://localhost:2283/api/server-info |
| 50 | + if [ $? -eq 0 ]; then |
| 51 | + echo "Immich API service is up and running!" |
| 52 | + else |
| 53 | + echo "Immich API service failed to respond!" |
| 54 | + exit 1 |
| 55 | + fi |
| 56 | +
|
| 57 | + - name: Verify Immich Web UI is accessible |
| 58 | + run: | |
| 59 | + echo "Verifying Immich Web UI..." |
| 60 | + # The web UI runs on IMMICH_WEB_PORT (8080 by default) as defined in .env |
| 61 | + curl -f -s http://localhost:8080/ |
| 62 | + if [ $? -eq 0 ]; then |
| 63 | + echo "Immich Web UI is accessible!" |
| 64 | + else |
| 65 | + echo "Immich Web UI failed to respond!" |
| 66 | + exit 1 |
| 67 | + fi |
| 68 | +
|
| 69 | + - name: Display running Docker containers (for debugging) |
| 70 | + if: always() # Run even if previous steps fail |
| 71 | + run: docker ps -a |
| 72 | + |
| 73 | + - name: Display Docker Compose logs (for debugging) |
| 74 | + if: always() # Run even if previous steps fail |
| 75 | + working-directory: docker-configs/immich |
| 76 | + run: docker compose logs |
0 commit comments