Skip to content

Commit c9f2bc3

Browse files
committed
feat: add reusable prod build
1 parent da2f30f commit c9f2bc3

File tree

2 files changed

+53
-3
lines changed

2 files changed

+53
-3
lines changed

.github/workflows/build-latest.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ jobs:
1616
prepare:
1717
runs-on: "ubuntu-latest"
1818
outputs:
19-
matrix: ${{ steps.set-matrix.outputs.matrix }}
19+
matrix: ${{ steps.matrix.outputs.matrix }}
2020
steps:
21-
- id: set-matrix
21+
- id: matrix
2222
run: |
23-
echo "::set-output name=matrix::{\"os_name\": [\"alpine\"], \"php_version\": [\"8.1\", \"8.2\"], \"php_type\": [\"fpm\", \"cli\", \"supervisord\"]}"
23+
echo 'matrix={
24+
"os_name": ["alpine"],
25+
"php_version": ["8.1", "8.2"],
26+
"php_type": ["fpm", "cli", "supervisord"]
27+
}' >> $GITHUB_OUTPUT
2428
2529
build:
2630
needs: prepare
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
3+
on: # yamllint disable-line rule:truthy
4+
release:
5+
types:
6+
- released
7+
8+
name: 🚀 Build docker images with release tag
9+
10+
jobs:
11+
# https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/expressions#example-returning-a-json-object
12+
prepare:
13+
runs-on: "ubuntu-latest"
14+
outputs:
15+
matrix: ${{ steps.matrix.outputs.matrix }}
16+
steps:
17+
- name: ⚙️ Generate matrix
18+
id: matrix
19+
run: |
20+
echo 'matrix={
21+
"os_name": ["alpine"],
22+
"php_version": ["8.1", "8.2"],
23+
"php_type": ["fpm", "cli", "supervisord"]
24+
}' >> $GITHUB_OUTPUT
25+
26+
- name: ⚙️ Get version for image tag
27+
id: version
28+
run: |
29+
echo "version=$(echo ${GITHUB_REF#refs/*/} | cut -c 2-)" >> $GITHUB_OUTPUT
30+
31+
build:
32+
needs: prepare
33+
strategy:
34+
matrix: ${{ fromJson(needs.prepare.outputs.matrix )}}
35+
uses: wayofdev/gh-actions/.github/workflows/build-image.yml@master
36+
with:
37+
os: "ubuntu-latest"
38+
push-to-hub: true
39+
image-namespace: "wayofdev/php-base"
40+
image-template: ${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}
41+
image-version: ${{ needs.prepare.outputs.version }}
42+
secrets:
43+
docker-username: ${{ secrets.DOCKER_USERNAME }}
44+
docker-password: ${{ secrets.DOCKER_TOKEN }}
45+
46+
...

0 commit comments

Comments
 (0)