-
Notifications
You must be signed in to change notification settings - Fork 12
133 lines (113 loc) · 4.16 KB
/
laravel-10.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Laravel 10
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '7 3 * * *'
jobs:
test:
name: Test
runs-on: ubuntu-latest
container:
image: php:8.1-cli
steps:
- name: Checkout
uses: actions/checkout@v2
- name: GitHub Environment Variables Action
uses: FranzDiebold/[email protected]
- name: PHPUnit
run: |
apt update
apt install -y libzip-dev unzip
pecl install xdebug
docker-php-ext-enable xdebug
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
composer require orchestra/testbench:^v8 --dev
composer run test
- name: Lint
run: composer run lint
- name: Lint Dockerfile
uses: hadolint/[email protected]
with:
dockerfile: src/stubs/Dockerfile
- name: codecov
uses: codecov/codecov-action@v1
with:
name: laravel-10
- name: install in real Laravel project
run: |
rm -rf laravel-demo
composer create-project --prefer-dist laravel/laravel laravel-demo "10.*"
cd laravel-demo && composer require --dev laravel-fans/docker:dev-${CI_ACTION_REF_NAME} && php artisan docker:publish
php artisan --version | awk '{print $3}' > .version
- name: Create Tar
run: tar -cvf laravel-demo.tar laravel-demo
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: laravel-demo
path: laravel-demo.tar
publish:
name: Publish Code and Docker
if: ${{ github.ref == 'refs/heads/main' }}
needs: test
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: laravel-demo
- name: Extract Tar
run: tar -xvf laravel-demo.tar
- name: Push code
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: laravel-demo
publish_branch: laravel-10
destination_dir: demo
allow_empty_commit: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Get Laravel version
working-directory: ./laravel-demo
run: |
echo "LARAVEL_VERSION=$(cat .version)" >> $GITHUB_ENV
echo "DOCKER_MANIFEST=$((DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect laravelfans/laravel:$(cat .version) > /dev/null && echo 'json') || echo '')" >> $GITHUB_ENV
echo "DOCKER_MANIFEST_DEV=$((DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect laravelfans/laravel:$(cat .version)-dev > /dev/null && echo 'json') || echo '')" >> $GITHUB_ENV
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
if: ${{ env.DOCKER_MANIFEST == '' || github.event_name == 'push' }}
with:
context: laravel-demo
platforms: linux/amd64,linux/arm64
push: true
tags: laravelfans/laravel:latest,laravelfans/laravel:10,laravelfans/laravel:${{ env.LARAVEL_VERSION }}
- name: Image digest
if: steps.docker_build.conclusion == 'success'
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Build and push dev
id: docker_build_dev
uses: docker/build-push-action@v3
if: ${{ env.DOCKER_MANIFEST_DEV == '' || github.event_name == 'push' }}
with:
context: laravel-demo
file: laravel-demo/Dockerfile.dev
platforms: linux/amd64,linux/arm64
push: true
tags: laravelfans/laravel:10-dev,laravelfans/laravel:${{ env.LARAVEL_VERSION }}-dev
- name: Image digest dev
if: steps.docker_build_dev.conclusion == 'success'
run: echo ${{ steps.docker_build_dev.outputs.digest }}