Skip to content

Commit 6fa20e5

Browse files
authored
Merge pull request #80 from lukasleitsch/feature/build-and-publish
Add packages workflow to build and push images
2 parents 691b427 + b9f11d4 commit 6fa20e5

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/packages.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build and publish packages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
IMAGE: lorisleiva/laravel-docker
10+
11+
jobs:
12+
docker:
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
include:
18+
- tag: 'latest'
19+
php: '8.0'
20+
- tag: 'stable'
21+
php: '8.0'
22+
- tag: '8.1'
23+
php: '8.1'
24+
- tag: '8.0'
25+
php: '8.0'
26+
- tag: '7.4'
27+
php: '7.4'
28+
29+
steps:
30+
- uses: actions/checkout@v2
31+
32+
- name: Login to GitHub Container Registry
33+
uses: docker/login-action@v1
34+
with:
35+
registry: ghcr.io
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Login to DockerHub
40+
uses: docker/login-action@v1
41+
with:
42+
username: ${{ secrets.DOCKERHUB_USERNAME }}
43+
password: ${{ secrets.DOCKERHUB_TOKEN }}
44+
45+
- name: Build and push
46+
id: docker_build
47+
uses: docker/build-push-action@v2
48+
with:
49+
push: true
50+
context: ${{ matrix.php }}
51+
tags: |
52+
ghcr.io/${{ env.IMAGE }}:${{ matrix.tag }}
53+
${{ env.IMAGE }}:${{ matrix.tag }}
54+
cache-from: type=registry,ref=ghcr.io/${{ env.IMAGE }}:${{ matrix.tag }}
55+
cache-to: type=inline

0 commit comments

Comments
 (0)