This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
73 lines (65 loc) · 2.01 KB
/
service_docker-build-and-publish.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
on:
workflow_call:
inputs:
platforms:
type: string
default: 'linux/amd64'
docker-tags:
required: true
type: string
dockerfile:
type: string
default: './Dockerfile'
target:
type: string
default: ''
environment:
type: string
required: true
env:
DOCKER_COMPOSE_CMD: docker compose -f docker-compose.yml -f docker-compose.ci.yml
jobs:
docker-publish:
runs-on: ubuntu-22.04
environment:
name: ${{ inputs.environment }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore composer cache (if available)
id: composer-vendor-restore
uses: actions/cache/restore@v3
with:
path: vendor/
key: ${{ runner.os }}-composer-vendor-${{ hashFiles('composer.lock') }}
- if: ${{ steps.composer-vendor-restore.outputs.cache-hit != 'true' }}
name: List the composer packages
continue-on-error: true
run: |
$DOCKER_COMPOSE_CMD \
run \
php \
composer show --locked
- if: ${{ steps.composer-vendor-restore.outputs.cache-hit != 'true' }}
name: Install Composer dependencies
run: |
$DOCKER_COMPOSE_CMD \
run \
php \
composer install --optimize-autoloader --no-interaction --no-progress --no-ansi
- name: Set env file
run: |
echo $BASE_64_SECRET | base64 -d > .env
chmod 600 .env
env:
BASE_64_SECRET: ${{ secrets.ENV_FILE_BASE64 }}
- name: docker-build-action
uses: serversideup/github-action-docker-build@main
with:
tags: "${{ inputs.docker-tags }}"
dockerfile: "${{ inputs.dockerfile }}"
registry: "ghcr.io"
registry-username: "${{ github.actor }}"
registry-token: "${{ secrets.GITHUB_TOKEN }}"
platforms: "${{ inputs.platforms }}"
target: "${{ inputs.target }}"