Skip to content

feat: wp-cron in worker #34

feat: wp-cron in worker

feat: wp-cron in worker #34

Workflow file for this run

name: Build and Push WordPress Images
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v22
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: Build Docker Images
run: |
nix build .#wordpress-php82 .#wordpress-php83 .#wordpress-php84
docker load < result
docker load < result-1
docker load < result-2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images to GitHub Container Registry
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
# Get the actual image names from Docker
IMAGES=($(docker images --format "{{.Repository}}:{{.Tag}}" | grep wordpress))
for IMAGE in "${IMAGES[@]}"; do
PHP_VERSION=$(echo $IMAGE | sed -n 's/.*-php\([0-9]\+\).*/\1/p')
FULL_IMAGE_ID=$IMAGE_ID:php$PHP_VERSION
docker tag $IMAGE $FULL_IMAGE_ID
docker push $FULL_IMAGE_ID
if [ "$VERSION" == "latest" ]; then
docker tag $FULL_IMAGE_ID $IMAGE_ID:latest-php$PHP_VERSION
docker push $IMAGE_ID:latest-php$PHP_VERSION
fi
done
# Tag one version as the default latest
DEFAULT_PHP_VERSION=83
docker tag $IMAGE_ID:php$DEFAULT_PHP_VERSION $IMAGE_ID:latest
docker push $IMAGE_ID:latest