Skip to content

Commit 1b2a677

Browse files
committed
feat: move to reusable workflow
1 parent c337192 commit 1b2a677

File tree

2 files changed

+12
-165
lines changed

2 files changed

+12
-165
lines changed

.github/workflows/build-latest.yml

Lines changed: 12 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -18,77 +18,17 @@ jobs:
1818
fail-fast: true
1919
matrix:
2020
os_name: ["alpine"]
21-
php_version: ["8.1"]
22-
php_type: ["fpm"]
23-
# php_version: ["8.1", "8.2"]
24-
# php_type: ["fpm", "cli", "supervisord"]
25-
environment:
26-
name: latest
27-
url: https://hub.docker.com/r/wayofdev/php-base/tags?page=1&name=latest
28-
29-
steps:
30-
- name: 📦 Check out the codebase
31-
uses: actions/checkout@v3
32-
33-
- name: 🛠️ Install goss and dgoss
34-
uses: e1himself/goss-installation-action@v1.1.0
35-
36-
- name: 🌎 Set environment variables
37-
env:
38-
IMAGE_NAMESPACE: wayofdev/php-base
39-
IMAGE_TEMPLATE: ${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}
40-
IMAGE_TAG: wayofdev/php-base:${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}-latest
41-
run: |
42-
echo "IMAGE_NAMESPACE=${IMAGE_NAMESPACE}" >> $GITHUB_ENV
43-
echo "IMAGE_TEMPLATE=${IMAGE_TEMPLATE}" >> $GITHUB_ENV
44-
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
45-
46-
- name: 🤖 Generate dist files
47-
run: make generate
48-
49-
- name: 🐳 Extract docker meta data
50-
id: meta
51-
uses: docker/metadata-action@v4
52-
with:
53-
images: ${{ env.IMAGE_NAMESPACE }}
54-
tags: |
55-
type=raw,event=branch,value=latest
56-
type=ref,event=pr
57-
type=semver,pattern={{version}}
58-
type=semver,pattern={{major}}.{{minor}}
59-
flavor: |
60-
latest=false
61-
prefix=${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}-
62-
63-
- name: 🔑 Login to docker-hub
64-
if: github.event_name != 'pull_request'
65-
uses: docker/login-action@v2
66-
with:
67-
username: ${{ secrets.DOCKER_USERNAME }}
68-
password: ${{ secrets.DOCKER_TOKEN }}
69-
70-
- name: 🖥️ Setup QEMU
71-
uses: docker/setup-qemu-action@v2
72-
with:
73-
platforms: arm64
74-
75-
- name: 🛠️ Setup docker Buildx
76-
uses: docker/setup-buildx-action@v2
77-
with:
78-
install: true
79-
80-
- name: 🚀 Build image and push to docker-hub
81-
uses: docker/build-push-action@v4
82-
with:
83-
context: ./dist/base/${{ env.IMAGE_TEMPLATE }}
84-
platforms: linux/amd64,linux/arm64
85-
push: ${{ github.event_name != 'pull_request' }}
86-
tags: ${{ steps.meta.outputs.tags }}
87-
cache-from: type=gha
88-
cache-to: type=gha,mode=max
89-
labels: ${{ steps.meta.outputs.labels }}
90-
91-
- name: 🧪 Test Docker image with "latest" tag
92-
run: IMAGE_TAG=${{ env.IMAGE_TAG }} make test
21+
php_version: ["8.1", "8.2"]
22+
php_type: ["fpm", "cli", "supervisord"]
23+
uses: wayofdev/gh-actions/.github/workflows/build-image.yml@master
24+
with:
25+
os: "ubuntu-latest"
26+
push-to-hub: ${{ github.event_name != 'pull_request' }}
27+
image-namespace: "wayofdev/php-base"
28+
image-template: ${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}
29+
image-version: latest
30+
secrets:
31+
docker-username: ${{ secrets.DOCKER_USERNAME }}
32+
docker-password: ${{ secrets.DOCKER_TOKEN }}
9333

9434
...

.github/workflows/build-release.yml

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)