update-docs #10106
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 docs to GitHub Pages | |
| on: | |
| # Runs on pushes targeting the default branch | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: | |
| - main | |
| # Runs when a repository_dispatch event with the type 'update-docs' is received | |
| repository_dispatch: | |
| types: [update-docs] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| # Build job | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| cache: "npm" | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.4" | |
| - name: Clone and setup Mbin repo | |
| run: git clone https://github.com/mbinOrg/mbin && cp mbin/.env.example mbin/.env | |
| - name: Install Npm dependencies | |
| run: npm ci | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| working-directory: ./mbin | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache composer cache directory | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Run update/build script | |
| env: | |
| APP_ENV: test # in the test environment the messengers will not get wrapped in a transaction | |
| DATABASE_URL: postgresql://mbin:ChangeThisPostgresPass@localhost:5432/mbin?serverVersion=16&charset=utf8 # being in the test environment automatically appends _test to the db name | |
| MESSENGER_TRANSPORT_DSN: sync:// | |
| MAILER_DSN: null://default | |
| REDIS_HOST: valkey | |
| REDIS_PORT: 6379 | |
| REDIS_PASSWORD: | |
| run: bash update_and_build.sh -f | |
| - name: Upload artifact | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./build | |
| services: | |
| postgres: | |
| # Docker Hub image | |
| image: postgres:18 | |
| # Provide the password for postgres | |
| env: | |
| POSTGRES_DB: mbin_test | |
| POSTGRES_USER: mbin | |
| POSTGRES_PASSWORD: ChangeThisPostgresPass | |
| # Set health checks to wait until postgres has started | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: ["5432:5432"] | |
| valkey: | |
| # Docker Hub image | |
| image: valkey/valkey | |
| # Set health checks to wait until redis has started | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: ["6379:6379"] | |
| # Deployment job | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |