-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (56 loc) · 2.11 KB
/
php.yml
File metadata and controls
64 lines (56 loc) · 2.11 KB
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
name: PHP
concurrency:
group: php-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
env:
APP: moodle
USER: ${{ github.actor }}
on:
workflow_call:
inputs:
SKIP_BUILDS:
type: string
description: 'Skip builds if set to YES'
required: false
default: 'NO'
jobs:
build-images:
name: '🐸 Build to JFrog'
runs-on: ubuntu-latest
if: (github.ref_name == 'dev' || github.ref_name == 'test' || github.ref_name == 'prod')
steps:
# Checkout the PR branch
- name: 📤 Checkout Target Branch
uses: actions/checkout@v3
with:
ref: dev
# Login to Artifactory
- name: 🔑 Login to Artifactory
uses: docker/login-action@v3
with:
registry: ${{ secrets.ARTIFACTORY_URL }}
username: ${{ secrets.ARTIFACTORY_USER }}
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: Setup Env Vars
id: dotenv
uses: falti/dotenv-action@v1
with:
path: example.env
export-variables: true
keys-case: upper
- name: Setup Versions Env Vars
id: dotenv_versions
uses: falti/dotenv-action@v1
with:
path: example.versions.env
export-variables: true
keys-case: upper
# Pull latest PHP base image and push to Artifactory
- name: 🛠️ Pull PHP base image and push to Artifactory
run: |
docker pull ${{ env.PHP_IMAGE }}
docker tag ${{ env.PHP_IMAGE }} ${{ secrets.ARTIFACTORY_URL }}/${{ env.PHP_IMAGE }}
docker push ${{ secrets.ARTIFACTORY_URL }}/${{ env.PHP_IMAGE }}
# Build PHP Image and push to Artifactory
- name: 🛠️ Build PHP Image and push to Artifactory
run: docker buildx build --cache-from type=gha --cache-to type=gha,mode=max --build-arg DOCKER_FROM_IMAGE=${{ secrets.ARTIFACTORY_URL }}/${{ env.PHP_IMAGE }} --tag ${{ secrets.ARTIFACTORY_URL }}/${{ env.PHP_DEPLOYMENT_NAME }}:${{ env.OPENSHIFT_DEPLOY_PROJECT }}-${{ github.ref_name }} --output=type=image,push=true --push -f ${{ env.PHP_DOCKER_FILE_PATH }} .