Skip to content

Release

Release #204

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
phar:
name: Compile PHAR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Prepare environment
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer:v2,phive
# Compile PHAR
- name: Install box
run: phive install --trust-gpg-keys 2DF45277AEF09A2F humbug/box
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
with:
composer-options: "--no-dev"
- name: Compile PHAR
run: ./tools/box compile --with-docker
# Upload compiled PHAR as artifact
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: phar
path: |
.build/cache-warmup.phar
Dockerfile
docker:
name: Docker deploy
runs-on: ubuntu-latest
needs: phar
steps:
- uses: actions/checkout@v4
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
# Download PHAR and Dockerfile
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: phar
- name: Make PHAR executable
run: chmod +x .build/cache-warmup.phar
# Generate metadata
- name: Generate image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
eliashaeussler/cache-warmup
ghcr.io/eliashaeussler/cache-warmup
tags: |
type=raw,value=latest,enable=${{ github.event_name != 'workflow_dispatch' }}
type=semver,pattern={{version}}
type=raw,value=${{ github.ref_name }},enable=${{ github.event_name == 'workflow_dispatch' }}
# Prepare build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Login at Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Login at GitHub container registry
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Build and push image
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
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' }}
runs-on: ubuntu-latest
needs: phar
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Check if tag is valid
- name: Check tag
run: |
if ! [[ ${{ github.ref }} =~ ^refs/tags/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then
exit 1
fi
# Download PHAR
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: phar
- name: Make PHAR executable
run: chmod +x .build/cache-warmup.phar
# Sign PHAR file
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.PHAR_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PHAR_GPG_PASSPHRASE }}
- name: Sign PHAR file
run: gpg --armor --output .build/cache-warmup.phar.asc --yes --detach-sig .build/cache-warmup.phar
# Create release
- name: Create release
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
artifacts: .build/cache-warmup.phar,.build/cache-warmup.phar.asc