-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (87 loc) · 3.02 KB
/
staging.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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