Skip to content

Commit

Permalink
[TASK] Publish PHAR file on documentation website
Browse files Browse the repository at this point in the history
  • Loading branch information
eliashaeussler committed Oct 25, 2024
1 parent 38301e5 commit b1e7f26
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 79 deletions.
67 changes: 0 additions & 67 deletions .github/workflows/docs.yaml

This file was deleted.

86 changes: 77 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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' }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b1e7f26

Please sign in to comment.