Skip to content

diana-mujoiu is performing an Graffino-Docker staging deployment #9

diana-mujoiu is performing an Graffino-Docker staging deployment

diana-mujoiu is performing an Graffino-Docker staging deployment #9

Workflow file for this run

name: graffino-docker-deploy-staging
run-name: ${{ github.actor }} is performing an Graffino-Docker staging deployment
on:
workflow_dispatch:
push:
branches:
- 'develop'
env:
REGISTRY: ghcr.io
jobs:
deploy-staging:
runs-on: [self-hosted, graffino, php8.2]
environment: Staging
env:
ENVIRONMENT: 'staging'
PHP_EXTENSIONS: ''
VERSION_TAG: 'v1.0.0'
VERSION_NO: '1.0.0'
VERSION_MAJOR: '1'
VERSION_MINOR: '0'
strategy:
matrix:
os: [ubuntu-latest]
node: [18]
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
if: success()
- name: Replace environment variables
uses: nightstory/replace-env@v2
id: create-env
env:
GH_PACKAGES_TOKEN: '${{ secrets.GH_PACKAGES_TOKEN }}'
GH_PACKAGES_USERNAME: '${{ secrets.GH_PACKAGES_USERNAME }}'
with:
input_file: .env.staging
output_file: .env
pattern: double_underscore
- name: Load .env variables
id: dotenv
uses: ahmadnassri/action-dotenv@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
id: Login-To-Container-Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Get version
id: get_version
run: |
VERSION_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV
VERSION_NO=${VERSION_TAG#v}
echo "VERSION_NO=$VERSION_NO" >> $GITHUB_ENV
VERSION_MAJOR=$(echo $VERSION_NO | cut -d. -f1)
echo "VERSION_MAJOR=$VERSION_MAJOR" >> $GITHUB_ENV
VERSION_MINOR=$(echo $VERSION_NO | cut -d. -f2)
echo "VERSION_MINOR=$VERSION_MINOR" >> $GITHUB_ENV
- name: Build and push PHP-FPM Base image
uses: docker/build-push-action@v6
id: Build_And_Push_PHP_FPM_Base
with:
context: .
build-args: |
PHP_EXTENSIONS=${{ env.PHP_EXTENSIONS }}
GH_PACKAGES_TOKEN=${{ secrets.GH_PACKAGES_TOKEN }}
GH_PACKAGES_USERNAME=${{ secrets.GH_PACKAGES_USERNAME }}
file: wordpress/.docker/php/Dockerfile.base
push: true
tags: |
${{ env.REGISTRY }}/graffino/graffino-php-fpm-base:latest
${{ env.REGISTRY }}/graffino/graffino-php-fpm-base:${{ env.VERSION_NO }}
${{ env.REGISTRY }}/graffino/graffino-php-fpm-base:${{ env.VERSION_MAJOR }}
${{ env.REGISTRY }}/graffino/graffino-php-fpm-base:${{ env.VERSION_MAJOR }}.${{ env.VERSION_MINOR }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/graffino/graffino-php-fpm-base
cache-to: type=inline