Skip to content

[RELEASE] Release of cache-warmup 3.0.0 #196

[RELEASE] Release of cache-warmup 3.0.0

[RELEASE] Release of cache-warmup 3.0.0 #196

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
# 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
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@v2
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@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Job: Create release
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