From b1e7f2631ff1718b53453478628f3bae56c8d173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=A4u=C3=9Fler?= Date: Fri, 25 Oct 2024 10:16:20 +0200 Subject: [PATCH] [TASK] Publish PHAR file on documentation website --- .github/workflows/docs.yaml | 67 -------------------------- .github/workflows/release.yaml | 86 ++++++++++++++++++++++++++++++---- README.md | 2 +- docs/installation.md | 4 +- 4 files changed, 80 insertions(+), 79 deletions(-) delete mode 100644 .github/workflows/docs.yaml diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml deleted file mode 100644 index 9c0fa305..00000000 --- a/.github/workflows/docs.yaml +++ /dev/null @@ -1,67 +0,0 @@ -name: Documentation -on: - push: - tags: - - '*' - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow one concurrent deployment -concurrency: - group: "pages" - cancel-in-progress: true - -jobs: - deploy: - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - # Prepare environment - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: npm - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 8.3 - coverage: none - - name: Setup Pages - uses: actions/configure-pages@v5 - - # Install dependencies - - name: Install Frontend dependencies - run: npm ci - - # Render documentation - - name: Render documentation - run: npm run docs:build - - # Deploy documentation - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: 'docs/.vitepress/dist' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 - - # Warm up cache - - name: Run cache warmup - uses: eliashaeussler/cache-warmup-action@v1 - with: - sitemaps: ${{ steps.deployment.outputs.page_url }}/sitemap.xml - progress: true - verbosity: v diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4ebb090b..6bab2c9e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -14,14 +14,6 @@ jobs: with: fetch-depth: 0 - # Check if tag is valid - - name: Check tag - if: ${{ github.event_name != 'workflow_dispatch' }} - run: | - if ! [[ ${{ github.ref }} =~ ^refs/tags/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then - exit 1 - fi - # Prepare environment - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -117,7 +109,83 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - # Job: Create release + docs: + name: Publish documentation + runs-on: ubuntu-latest + needs: phar + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages + permissions: + contents: read + pages: write + id-token: write + + # Allow one concurrent deployment + concurrency: + group: pages + cancel-in-progress: true + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # Prepare environment + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + coverage: none + - name: Setup Pages + uses: actions/configure-pages@v5 + + # Download PHAR file + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: phar + - name: Make PHAR executable + run: chmod +x .build/cache-warmup.phar + + # Move PHAR to public folder + - name: Publish PHAR file + run: | + mv -v .build/cache-warmup.phar docs/public/ + mv -v .build/cache-warmup.phar.asc docs/public/ + + # Install dependencies + - name: Install Frontend dependencies + run: npm ci + + # Render documentation + - name: Render documentation + run: npm run docs:build + + # Deploy documentation + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: 'docs/.vitepress/dist' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + + # Warm up cache + - name: Run cache warmup + uses: eliashaeussler/cache-warmup-action@v1 + with: + sitemaps: ${{ steps.deployment.outputs.page_url }}/sitemap.xml + progress: true + verbosity: v + release: name: Create release if: ${{ github.event_name != 'workflow_dispatch' }} diff --git a/README.md b/README.md index baf2a519..5ba20f97 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ A PHP library to warm up website caches of URLs located in XML sitemaps. ```bash # Download latest release -curl -LO https://github.com/eliashaeussler/cache-warmup/releases/latest/download/cache-warmup.phar +curl -O https://cache-warmup.dev/cache-warmup.phar chmod +x cache-warmup.phar # Run cache warmup diff --git a/docs/installation.md b/docs/installation.md index 24b98515..95a44129 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -17,7 +17,7 @@ Choose one of the following installation methods to download the ::: code-group ```bash [PHAR] -curl -LO https://github.com/eliashaeussler/cache-warmup/releases/latest/download/cache-warmup.phar +curl -O https://cache-warmup.dev/cache-warmup.phar chmod +x cache-warmup.phar ``` @@ -47,7 +47,7 @@ using your local GPG installation: ```bash # Download GPG signature -curl -LO https://github.com/eliashaeussler/cache-warmup/releases/latest/download/cache-warmup.phar.asc +curl -O https://cache-warmup.dev/cache-warmup.phar.asc # Import public GPG key gpg --keyserver keys.openpgp.org --recv-keys E73F20790A629A2CEF2E9AE57C1C5363490E851E